|
|
| Subject: | XploRe: Learning Guide |
| See XploRe: |
| Quantlet: | quant11 | |
| Description: | Factorial with while - endo. | |
| Download: | quant11.xpl |
proc(j) = factorial(x)
; defines a procedure named "factorial"
j = 1 ; defines the variable j as 1
while (x >= 2) ; as long as this condition is fulfilled,
; XploRe executes the following commands
j = j * x ; computes j as the product of j and x
x = x - 1 ; reduces x by 1
endo ; end of the while loop
endp ; end of the procedure
;
factorial(5) ; runs the procedure with value 5
| Subject: | XploRe: Learning Guide |
| See XploRe: |