2

Do you put Caps to public variable ?

My IDE was doing caps to public variable but someone told me that he was wrong it's not caps for public variable only functions.

Comments
  • 0
    Capital Letters. I think ?
  • 1
    Like
    public function I_IS_A_FUNCTION() ?
  • 1
    Boy, your english is a mess.

    Coding conventions are usually pretty specific per language, but I think it's pretty common in enterprisey .NET type languages to use PascalCasing for field names. Other languages commonly also use camelCasing. It's a bit hard here to tell exactly what you're asking.
  • 0
    You don't tell us the language. In Go, for example, everything that is public (or, as it is called in Go: exported) has to start with a capital letter. In Python, though not enforced through the interpreter/compiler, it is common to have private stuff begin with an underscore.

    In languages where private/public is handled otherwise it is up to the design guide of your company, and if your company tells you that they want to have public variables starting with a lowercase letter than so be it, there is nothing inherently wrong with that. Just tell your IDE to not capitalize public variables.
  • 1
    Taking a look at your bio, you are almost certainly talking about C#.

    You can have a look at the style guide to see what you're "supposed" to do.

    In c#, most member data (Function and variable) is in PascalCase rather than camelCase, and only local variables are really camelCase.

    This is unusual and really only applies to C# in my experience.

    Most other languages encourage camelCase for all member data, and languages like c just don't have a fucking universal style.
  • 0
    @HollowKitty I'm french. So yes my english might be a bit weird.
    I'm doing my best...

    I'm talking about VARIABLES.
    Their is a law that say you have to put a _ before the variable name if it's an private variable and the public variables should have a lower case for the first letter of the variable.

    My IDE was putting a Upper Case, CAPS for my first letter of my piblic variables and not lower case. So someone told me that it's wrong it have to be lower case but i don't know if he is true.

    Is it lower case or Upper case, is their a law about this?

    I don't know what do you not understand... All look correct.
  • 0
    @AlgoRythm Alright that's the answer i was searching for. Ok so i've to change it to lowercase..
    I don't know why but Jetbrains Rider was putting PascalCase for public variables.

    Sorry for my english again and yes the labguage i was talking for is C#.

    Thanks
  • 0
    @irene Wow you you say the inverse. I'm so confused lol.
    Is it a preference, a choice or it's a coding style that we have to follow.

    It's look like a preference because some people tell us to use camelCase..
  • 0
    Mh'ok i thought he saied that it was mostly PascalCase.

    Ok ok thanks you !
Add Comment