05-12-2021, 01:58 AM
Hello
The ARGS system variable stores the sequence of arguments entered in a function, including the name of the function.
the sentence print( y ); closes the simulator ( win 10)
f( 9, 8, 7 ) [enter]
f( 6, 5, 4 ) [enter] // seq[6, 5, 4] -> args
The ARGS system variable stores the sequence of arguments entered in a function, including the name of the function.
the sentence print( y ); closes the simulator ( win 10)
f( 9, 8, 7 ) [enter]
PHP Code:
#cas
f( a, b, c ):= // a:= 9, b:=8, c:=7 , and seq[a, b, c] -> args
begin
local y;
y := args; // argument list
print( size( args ) ); // args: 4
print( args[ 1 ] ); // function name: f
print( args[ 2 ] ); // firts arg: 9
print( args[ 3 ] ) ; // second arg: 8
print( args[ 4 ] ); // Third arg: 7
//print( args[ 5 ] ); // trying to access a non-existent argument
print( y ); // [ f, 9, 8, 7 ]
return y; // [ f, 9, 8, 7 ]
end;
f( 6, 5, 4 ) [enter] // seq[6, 5, 4] -> args
PHP Code:
#cas
f1( args ):=
begin
local y;
y := args; // argument list
print( size( args ) ); // args: 3
print( args[ 1 ] ); // function name: f
print( args[ 2 ] ); // firts arg (arg list): 6, 5, 4
// print( args[ 3 ] ); // // trying to access a non-existent argument
print( y ); // 6, 5, 4
return y; // 6, 5, 4
end;