Why senior developers write two words like this MAX_VALUE and not like this MAXVALUE. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why senior developers write two words like this MAX_VALUE and not like this MAXVALUE.

Even I have seen that they declared a variable for list like this _LIST and deleted this LIST tell me any reason

28th Jul 2019, 5:20 AM
Nikhil Tale
Nikhil Tale - avatar
4 Answers
+ 3
Because second variant is more readable. It's a good practice
28th Jul 2019, 5:33 AM
Timur Myngbay
Timur Myngbay - avatar
+ 3
In Python, there is a datatype called list. If you write: list = [1, 2, 3] Then you overwrite the name for the datatype list and can't use it anymore. So you change the name just a bit. list_ = [1, 2, 3]
28th Jul 2019, 5:40 AM
HonFu
HonFu - avatar
+ 2
The reasons is as follows: first : There are rules to write (variables). If you have long variable like Max value you should put underscore instead space. Second : Helps the programmer to read and modify the code. Third: you can search about how to write the variables. Most of the programming languages ​​have the same rules. And Some word is Reserved word you can not use such as List in python and some programmer write List_ in this case you can use it.
28th Jul 2019, 3:39 PM
Waad
0
Timur Myngbay does it makes code faster, as it is more readable
28th Jul 2019, 5:48 AM
Nikhil Tale
Nikhil Tale - avatar