Post Reply 
2021: args cmd
05-12-2021, 01:58 AM (This post was last modified: 05-12-2021 05:29 PM by compsystems.)
Post: #1
2021: args cmd
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
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)