It’s amazing how planning, and taking preemptive action in general, can save you incredible amounts of time.
This principle even holds true when creating variables in code.
To understand the value of variables we start by asking: What’s the point of a variable?”
- Variables allow us to store information
- Variables allow us to quickly reuse a value in our program.
- Variables let us easily change a value in our program
When we do not use variables and instead use value without assigning it to a variable, that’s known as hardcoding. While hardcoding is sometimes initially faster, in the long run you’ll run into trouble — especially if you need to change what those values are.
A good reminder to do the upfront work, plan and sow to reap the time-saving rewards later.