In the manual we have two demonstrations of the Var keyword:
and
Firstly, why does Var come after the variable in the first example and before the variable in the second example?
In the first example, it looks like the variables are being passed "By Reference" so that the actual variables passed are affected by the function call.
In the second example, 'p' is pointing to the first element of the array 'c' and adding 1 to the pointer simply jumps to the next entry (which is one integer 'further up' in this case).
I basically get it, but just wonder if there's some significance as to why Var is not consistantly used in the two examples.
Thanks,
Russell
Function ReturnMultiplevalues(a Var,b Var,c Var) a=10 b=20 c=30 Return End Function Local x,y,z ReturnMultipleValues(x,y,z) Print "x="+x '10 Print "y="+y '20 Print "z="+z '30
and
Local c[]=[1,2,3,4] Local p:Int Ptr p=c Print "var p="+Var p '1 p:+1 Print "var p="+Var p '2 p:+1 Print "var p="+Var p '3 p:+1 Print "var p="+Var p '4
Firstly, why does Var come after the variable in the first example and before the variable in the second example?
In the first example, it looks like the variables are being passed "By Reference" so that the actual variables passed are affected by the function call.
In the second example, 'p' is pointing to the first element of the array 'c' and adding 1 to the pointer simply jumps to the next entry (which is one integer 'further up' in this case).
I basically get it, but just wonder if there's some significance as to why Var is not consistantly used in the two examples.
Thanks,
Russell