args[ 0 ] > size( args )

Messages in english

Modérateur : xcasadmin

compsystems
Messages : 554
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

args[ 0 ] > size( args )

Message par compsystems » mer. mai 12, 2021 3:20 am

Hello, a new option for args can be args[0] equivalent to determining the number of arguments size( args )

Code : Tout sélectionner

//#cas
f( a, b, c ):=
begin
 local y;
 y := args;
 print( size( args ) ); // args: 4
 // print( args[ 0 ] );  // 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]);
 print( y ); // [ f, 9, 8, 7]
 return y;  //  [ f, 9, 8, 7]
end;
f( 9, 8, 7 ) enter [ f, 9, 8, 7]

Répondre