File:  [gforth] / gforth / vmgen-ex / fib.mini
Revision 1.1: download - view: text, annotated - select for diffs
Sun Apr 29 11:28:23 2001 UTC (19 years, 8 months ago) by anton
Branches: MAIN
CVS tags: v0-7-0, v0-6-2, v0-6-1, v0-6-0, HEAD
added vmgen-ex

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;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>