Const meaning (guessing)

I’m on the lesson talking about assigning values with variables, and trying to figure out what “const” does before assigning a variable.

My guess is that const means “constant”, which will “permanently” assign a variable, in such a way that somehow it will ignore any changes that could affect that variables value further down in the code.

I am assuming that if you try to change it’s value, it will just ignore the changes and the assigned variable will always reference it’s initial/permanent value? Which makes me wonder if we will later be talking about ways we can ACTUALLY change a variables value, so that when we reference said variable later, it will be flexible in it’s value.

Trying to use problem solving here…I think that in the context of triplex, the a + b + c and a * b * c formulas will be used for each level in the game, but each time a new level is accessed, it will change the values of what a/b/c are - which will mean you need to input different answers, even though you are always working with the three variables: a, b and c.

Therefore, I don’t think const will actually be used in triplex…at least with the variables. The sum and product might use them (I didn’t realize until restarting the video that I needed to add const before the sum and product lines…whoops! lol)

Privacy & Terms