support/testing/tests/package/test_tcl.py: new runtime test

Signed-off-by: Julien Olivain <ju.o@free.fr>
[Arnout: use f-string instead of string.format]
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
This commit is contained in:
Julien Olivain
2023-09-17 19:12:44 +02:00
committed by Arnout Vandecappelle
parent 47cbcb70d0
commit 2031fc8809
3 changed files with 63 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
#! /usr/bin/env tclsh
proc factorial {n} {
set f 1
for {set i 1} {$i <= $n} {incr i} {
set f [expr {$f * $i}]
}
return $f
}
puts [factorial [lindex $argv 0]]