Here is my work for Exercise 32.
In the exercise code, Zed Shaw asks if you remember the other two ways from the previous exercise. I have written two other ways to print out the numbers array in comments.
1. Convert this while-loop to a function that you can call, and replace 6 in the test (i < 6) with a variable.
2. Use this function to rewrite the script to try different numbers.
On line 17 and line 18, I call the function using 3 and 6.
3. Add another variable to the function arguments that you can pass in that lets you change the + 1 on line 8 so you can change how much it increments by.
3. Rewrite the script again to use this function to see what effect that has.
4. Write it to use for-loops and (0 .. 6) range operator. Do you need the incrementor in the middle anymore? What happens if you do not get rid of it?
An increment operation is not needed because the for loop automatically increments through the values of the range operator.
Note that the upper_limit parameter in this function indicates the number that WILL NOT be added to the numbers array. If we wanted the upper_limit number to be the last element added to the array, we would type (0..upper_limit) on line 4 instead. The numbers would then be 0, 1, 2, 3, 4, 5, 6.
This exercise introduces while loops. It also shows that some while loops can be rewritten into for loops. When writing a while loop, it is important to check the condition (and its changes) throughout the loop so that you do not end up with an endless loop.