|
|
| Subject: | XploRe: Learning Guide |
| See XploRe: |
| Quantlet: | quant12 | |
| Description: | Factorial with do - until. | |
| Download: | quant12.xpl |
proc(j) = factorial(x) ; defines a procedure named "factorial"
j = 1 ; defines the variable j as 1
do ; opens the do loop
j = j *x ; computes j as the product of j and x
x = x -1 ; reduces x by 1
until (x < 2) ; if the condition is not fulfilled,
; the loop will be run again
endp ; end of the procedure
;
factorial(5) ; runs the procedure with value 5
| Subject: | XploRe: Learning Guide |
| See XploRe: |