Why would you make it constant? To protect it against other programmers? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why would you make it constant? To protect it against other programmers?

18th Jul 2016, 10:41 PM
Mike
4 Answers
+ 4
Sometimes you need a constant like PI to use it several times in different statements. Using constant prevents it from being changed by mistake and also improve memory usage efficiency.
27th Jan 2017, 12:00 PM
Mohammad Mehrabi
Mohammad Mehrabi - avatar
+ 1
beacuse it should be constant no other thing
20th Jul 2016, 8:26 AM
Lea Rose Tuazon Dabocol
Lea Rose Tuazon Dabocol - avatar
0
No one, including a god and yourself, should manipulate numbers like the average constant of earth gravity. Huiiiii! ;)
23rd Jul 2016, 1:55 PM
Idril
Idril - avatar
0
Because thou shall not change it in your program
2nd Dec 2016, 8:01 AM
acpa