I think const is short for constant. Meaning, when we declare something as a constant, it will always be there.
Based of the error that I got, const means that you are making the variable not changeable. it only has the value that you declare it with and cant be change.
I think that const may be a keyword to make our values unchangeable. This would mean that any attempt to make a change to them will throw an error.
From previous experience, const is short for constant, and is different from a variable in that the value cannot be changed apart the value that is set at initialisation.
The const keyword (as I understand it) dictates that the variable declared with its prefix cannot be reassigned a different valueā¦ But I donāt fully understand the utility outside of physics/mathematical formulas.
- I might be getting ahead of myself, but assuming we delve into Classes, doesnāt a public static variable effectively do the same thing as a const variable?
I believe that const will force a variable to no longer be a variable (rather a constant)?
I am not sure where the value in this would be (ie: why wouldnt I just use the value, rather than a āvariableā?) - Unless you can make it constant after it has undergone some changes/calculations ā¦
Looking forward to finding out.
so, from what I know about contacts from math - is that they donāt change, so my guess is that by saying to a computer that it is a cont - it is not to be touched no matter what