We used let
to make a variable inside of a function (the tick
function), and it’s surprisingly convenient and easy! However, that variable only exists inside that function, and if you try to reference it anywhere else, the program won’t know what you’re talking about.
Advantages of Local Variables
- Don’t have to use the keyword
this
to access them.
Disadvantages of Local Variables
- Can’t access them outside of their scope (e.g. in another function)
- Don’t show up in the Entity panel