Exploring what arrays are and how to use them!
There are many times in programming when many related values will need to be sorted. For example, suppose you are creating a machine that can produce 100 parts for a given run. Now suppose that for each part, the machine will need to store the part’s weight, length, and height. If you created a variable for each part’s attribute, you would need to create 300 variables. Put simply, that would be a poorly implemented program that would be nearly impossible to troubleshoot and debug. A much easier approach would be to make three variables that can each hold 100 values. Until now, we haven’t been able to do this. As we’ve seen until now, one variable holds one and only one value. So, how can we store 100 values in a single variable? Enter the world of arrays!
What is an array?
Put simply, an array is a variable that can hold multiple related values. The easiest way to think about an array is as the crew of...