This is a simple program that illustrates the most basic aspects of a byval parameter.
trace | A | B | C | D | explanation |
1 | line# | y |
|
||
2 | pre | ? | Watch the value of “y” and see how and where it gets changed. |
||
3 | 5 | retline# | x | Like a local variable, a byval parameter is allocated a column when a subroutine is invoked. |
|
4 | post | 5 | Unlike a local variable, a byval parameter does start with a specific value. In this case, it is determined by the invoke statement on line 5. The notation “5 → x” on line 5 uses the expression on the left (5) to specify the parameter on the right (x). Note that “5” in this case is called an “argument”. An argument is what an invoke statement uses to specify a parameter of a subroutine. |
||
5 | 3 | 8 |
| ||
6 | 4 | retline# | x | ||
7 | post |
|
|||