Variable names cannot start with capital letters? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Variable names cannot start with capital letters?

The lesson says that variable names cannot start with capital letters, I thought that was weird so I tried it and it works? What exactly is supposed to be the error? Or is it just convention?

6th Apr 2017, 12:49 PM
Karlo Melendez
Karlo Melendez - avatar
4 Answers
+ 1
Well, they're constants, of course. Kind of got ahead of the course a bit I guess.
6th Apr 2017, 12:51 PM
Karlo Melendez
Karlo Melendez - avatar
+ 1
Its just a good programming practice that you should not name your variable with capital letters. You can but you should not.
6th Apr 2017, 12:59 PM
Satish Singh
Satish Singh - avatar
+ 1
It's a convention. Generally, you should follow whatever convention is expected from one's employer or educational institution. The convention exists for the purpose of other programmers to more readily understand the code you've made. On your own, you can use whatever convention is convenient for you.
6th Apr 2017, 4:10 PM
Joseph B. Walton
Joseph B. Walton - avatar
0
you can but - you should not really as it is unconventional ``` irb(main):002:0* Var = 5 => 5 irb(main):003:0> Var.class => Fixnum irb(main):004:0> ```
12th Apr 2017, 10:46 PM
Akachi Ugwa