|
Now let's modify the procedure again so we can specify the location of the bottom vertex of the triangle. In the original procedure that vertex was at coordinates (100, 100).
|
You have to be careful that the type of the arguments and the type of the parameters match. The following procedure calls are all incorrect:
|
Here is an example where the types of the parameters are different:
|
123.45600 12.4005.00 543.211 |
It is also possible to use arrays as parameters. Here is a procedure that will print the elements in an array that stores 50 elements. The procedure will print the numbers ten to a line:
|
It is possible to make this procedure more flexible. You don't have to specify how large the array will be. We can use the asterisk (*) as a wild card to represent any size. We can use the function upper to see how large the arrray actually is when we print the elements in the procedure.
Here is a sample program with a modified version of printArray that can handle any size:
|
Here's the output from this program:
Here is the small array: 10 20 30 40 -------------------------------------------------- Here is the large array: 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 |
|