An example of a recursive procedure is
proc factorial {number} { if {$number <= 1} { return 1 } return [expr $number * [factorial [expr $number - 1]]] } puts [factorial 5] puts [factorial 10]
Result:
120 3628800
Jan 4, 2022 | tcl | 0 comments
An example of a recursive procedure is
proc factorial {number} { if {$number <= 1} { return 1 } return [expr $number * [factorial [expr $number - 1]]] } puts [factorial 5] puts [factorial 10]
Result:
120 3628800
Subscribe now to keep reading and get access to the full archive.
Recent Comments