0

Capitalization

Must you capitalise the second word of the identifier? Such as myAge. Could it be myage or MyAge?

13th Aug 2018, 9:27 AM
Cactus King
Cactus King - avatar
2 Réponses
+ 3
Lets take an example Suppose you want to declare a variable named first name. Now as spacing is not allowed , most common way is to write it as firstName to show its not one word like firstname but its another word. Btw other one is also fine. It depends on you. Hope thia helps☺️☺️
13th Aug 2018, 9:38 AM
Meet Mehta
Meet Mehta - avatar
+ 1
It depends on language you use. For exmple, in Ruby you can't name normal variable with capital letter on it's beggining, because only constants are names with capital letter. In most languages you can use myAge, MyAge or myage, but the first methd is prefered. It's called camel-case style. It's easier to read.
13th Aug 2018, 9:36 AM
Jan Štěch
Jan Štěch - avatar