HP Forums

Full Version: 2021: args cmd
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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]
PHP Code:
#cas
fab):= //  a:= 9, b:=8, c:=7 , and  seq[a, b, c] -> args
begin
 local y
;
 
:= args//  argument list
 
print( sizeargs ) ); // args: 4
 
print( args] );  // function name: f
 
print( args] );  // firts arg: 9
 
print( args] ) ;  // second arg: 8
 
print( args] );   // Third arg: 7
 //print( args[ 5 ] ); //  trying to access a non-existent argument
 
print( ); // [ f, 9, 8, 7 ]
 
return y;  //  [ f, 9, 8, 7 ]
end

f( 6, 5, 4 ) [enter] // seq[6, 5, 4] -> args
PHP Code:
#cas
f1args ):=
begin
 local y
;
 
:= args// argument list
 
print( sizeargs ) ); // args: 3
 
print( args] );  // function name: f
 
print( args] );  // firts arg (arg list): 6, 5, 4
 // print( args[ 3 ] );  // //  trying to access a non-existent argument
 
print( ); // 6, 5, 4
 
return y;  //  6, 5, 4
end
Reference URL's