+ 2

It says you cannot start a variable name with capital letter but it allows its use in 'try it yourself' section..

5th Nov 2016, 5:26 AM
Jnanesh Prabhu
Jnanesh Prabhu - avatar
5 Réponses
+ 11
yes you can, but variable name start with capital letter in ruby means constant. you cant change its value when already initialized. same with "final" keyword in java.
5th Nov 2016, 10:40 AM
Ridif Ariyadi
Ridif Ariyadi - avatar
+ 5
Variables are those who's value can be changed during the execution of the program. And constants are those who's values once assigned are fixed and cannot be changed during execution. And so in Ruby the variables are given name which starts with small letter and constants using capital. This is a rule of the language. If you try to change the value of constant you will get an error.
20th Nov 2016, 6:58 AM
Sampreet Gaonkar
+ 4
as a variable, it is not allowed. But as a constant (which is also a subclassification of variable), it needs to start with capital letter.
5th Nov 2016, 9:22 AM
Hanz Cliebb Tura
Hanz Cliebb Tura - avatar
+ 2
Its a constant if the variable begins with Caps
7th Nov 2016, 10:51 AM
prassanna john paul augustin
prassanna john paul augustin - avatar
0
you can assign different values to same variable in ruby. but if the variable name starts with capital letter, it can't be changed after first assignment
20th Nov 2016, 5:40 AM
Akash Vibhute
Akash Vibhute - avatar