home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Practical Programming in Tcl & Tk (4th Edition)
/
TCLBOOK4.BIN
/
pc
/
exsource.old
/
1_13.tcl
< prev
next >
Wrap
Text File
|
2003-04-15
|
217b
|
18 lines
#
# Example 1-13
# A while loop to compute factorial.
#
proc Factorial {x} {
set i 1; set product 1
while {$i <= $x} {
set product [expr {$product * $i}]
incr i
}
return $product
}
Factorial 10
#=> 3628800