Why would a constant integer or float value be useful? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why would a constant integer or float value be useful?

They can't be changed yea and can probably be used for formulas. Just dont change it. Maybe if your in a group and you have a variable you dont want others to change?

27th Jun 2019, 4:50 AM
kyle bridgewater
kyle bridgewater - avatar
1 Answer
+ 2
If we talk about pi which 3.14 Which is constant and we don't want that no anyone cannot change the pi variable value in your class.that's why we use constant variable.there is also other examples like value of sin(90), meters in 1 km etc.
27th Jun 2019, 5:04 AM
Maninder $ingh
Maninder $ingh - avatar