File: fib.mini

package info (click to toggle)
gforth 0.7.3%2Bdfsg-9
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid
  • size: 5,992 kB
  • sloc: ansic: 8,535; sh: 3,666; lisp: 1,778; makefile: 1,019; yacc: 186; sed: 141; lex: 102; awk: 21
file content (14 lines) | stat: -rw-r--r-- 228 bytes parent folder | download | duplicates (16)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
func fib(n)
  var r;
  if n<2 then
    r:=1;
  else
    r:=fib(n-1)+fib(n-2);
  end if;
  return r; 
  // the language syntax (return only at end) leads to inefficient code here
end func;

func main()
  return fib(34);
end func;