Displaying a List
We continue defining functions for our list by creating one that displays a list, element by element:
DETAILS
In this case, we did not need a value or object to be returned, only to be displayed, so
return is missing, being optional.
We read: for each element of the object
x, we display its value.
The variable
list1 holds the object created by the
create_list function, which is then passed as an actual
parameter to the
display_list function.
EXERCISE
Style the
display_list function a bit. It would look better if the results were like "
Element 0: a", etc.
Proceed to the next page.