Why a-variable-name ia not a valid variable name? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why a-variable-name ia not a valid variable name?

15th Jun 2018, 3:06 PM
Prathap Reddy Chennareddy
Prathap Reddy Chennareddy - avatar
2 Answers
+ 2
Because it has the '-' character. A valid name would be a_variable_name.
15th Jun 2018, 3:13 PM
Alexandru Turculet
Alexandru Turculet - avatar
+ 2
Depends upon the programming language. For some it's valid, for some others it isn't. If I were to guess as to why, I'd say it's because '-' is also an operator symbol, but I'm merely speculating. https://en.wikipedia.org/wiki/Naming_convention_(programming)
15th Jun 2018, 3:20 PM
Fata1 Err0r
Fata1 Err0r - avatar