ISSKIPPED Function

ISSKIPPED (x) ;

The ISSKIPPED function enables you to determine at run time whether any optional argument to a user-defined module was skipped. You can call the function only from within a module.

The ISSKIPPED function returns 0 if the symbol x was provided as an argument in the current call to the module. If the symbol was not provided (that is, it was skipped), the ISSKIPPED function returns 0.

The following module contains one required argument, x. The parameters a and y are optional. The first argument has a default value of 1, which means that a equals 1 if the first argument is not provided to the module. In contrast, the third argument does not have a default value. If the module is called without specifying the third parameter, the matrix y is the empty matrix. The following statements call the module with different combinations of supplied and skipped arguments.

start axpy(a=1, x, y=);
   if isskipped(y) then z = a#x;
   else                 z = a#x + y;
   return(z);
finish;

p = {1,2,3,4};
q = 1;
z1 = axpy( , p);    /* a and y skipped; a has default value */
z2 = axpy(2, p);    /* y skipped */
z3 = axpy(2, p, q); /* no parameter skipped */
print z1 z2 z3;

Figure 24.175: Skipping Module Arguments

z1 z2 z3
1 2 3
2 4 5
3 6 7
4 8 9