TCL的過程:spa
Vivado% proc factorial {number} { if {$number <= 1} { return 1 } return [expr $number * [factorial [expr $number - 1]]] } Vivado% puts [factorial 3] 6
Vivado% proc factorial {number {5} } { if {$number <= 1} { return 1 } return [expr $number * [factorial [expr $number - 1]]] } Vivado% puts [factorial ] wrong # args: should be "factorial number 5" Vivado% puts [factorial {3 5}] wrong # args: should be "factorial number 5" Vivado% puts [factorial {3}] wrong # args: should be "factorial number 5"