un-inception/test/fib.tcl
Russell Ballestrini 2b35819393 Initial commit: 42 UN CLI implementations
Unsandbox CLI implementations in 42 programming languages for the
permacomputer project. Public domain software for code execution
across all ecosystems.

Languages: Python, JavaScript, Ruby, Go, Rust, C, C++, Java, Kotlin,
C#, F#, Haskell, OCaml, Clojure, Scheme, Common Lisp, Erlang, Elixir,
D, Nim, Zig, V, Dart, Groovy, Scala, Julia, R, Crystal, Fortran,
COBOL, Prolog, Forth, Tcl, Raku, Lua, PHP, Perl, Bash, TypeScript,
Objective-C, PowerShell, AWK

Includes test suites and service lifecycle tests.
2025-12-23 09:57:08 -05:00

12 lines
217 B
Tcl

#!/usr/bin/env tclsh
proc fib {n} {
if {$n <= 1} {
return $n
}
return [expr {[fib [expr {$n - 1}]] + [fib [expr {$n - 2}]]}]
}
for {set i 0} {$i <= 10} {incr i} {
puts "fib($i) = [fib $i]"
}