HP Forums
2021: args cmd - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: 2021: args cmd (/thread-16922.html)



2021: args cmd - compsystems - 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]
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