What does it mean for code to be reusable and what good is that?
You may hear people mention DRY programming, which stands for Don’t Repeat Yourself. Simple enough, but you’d be surprised how much time and effort you’ll save by following through with it!
Often at times we’ll write code that needs some functionality repeated several times, perhaps even with different values each time. For example, if we tried to calculate the cost of a bill and tip for every meal, we’d have to write out the entire calculation each time for every different meal!
Wouldn’t it be better if we could give the cost of the meal to a function and have it handled the same way regardless of what the meal is or how much it cost?
That’s what we’ll be looking into for the next little while! Making functions that are able to do some action given some input and produce some output, all in the name of saving time and energy!