Factorial Procedure
proc fac x {
if $x<=1 {return 1}
expr $x*[fac [expr $x-1]]
}
fac 4 returns 24
Previous slide
Next slide
Back to first slide
View graphic version