0
Numbers or constants?
For example I need to use the number 3 several times in my code, is it better to use 3 every time or to make a constant with the value of 3? Same with strings f.e., use it like a text every time or make a constant? May be dumb and insignificant but it has been bothering me for some time
1 Antwort
0
Constant variables are not mutable and what that means that they cannot change during the execution of the code so if you need variables that should not be changed then use the constant if they need to change, you can still use the constants but you will have to copy it to another variable and change it there.