Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Group: Flow Control
See also: do endo until

Function: while
Description: while begins a loop if the first element of the argument is true. while has to be followed by an endo.


Usage: while (cond) endo
Input:
cond n x 1 vector of condition

Note:

Example:



proc(j) = factorial(x) 

  j = 1           

  while (x >= 2)   

    j = j * x   

    x = x - 1     

  endo           

endp             



factorial(5)

Result:



Contents of j

[1,]      120 


Group: Flow Control
See also: do endo until

Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

(C) MD*TECH Method and Data Technologies, 21.9.2000