Xan wrote:
> I don't know why this code:
> FUNC fibo(int a) int
> IF a <= 2
> RETURN 1
> ELSE
> RETURN fibo(a - 1) + fibo(a - 2)
> }
> RETURN 0
> }
> FUNC MAIN() int
> IF ARG.size() != 0
> IO.write(fibo(ARG.get(0)))
> ELSE
> IO.write("Falten arguments\n")
> }
> RETURN 0
> }
> produces me an error:
> $ ../zimbu fibonnaci.zu
> fibonnaci.zu line 13 col 13: ERROR: More than one method with matching
> arguments for write(unknown)
> fibonnaci.zu line 721 col 3: ERROR: here
> fibonnaci.zu line 715 col 3: ERROR: and here
> fibonnaci.zu line 13 col 13: ERROR: builtinModule member not found: write
Note that the file names are wrong in the last three errors. That's a
known bug.
The actual error is somehow not printed. I'll see if I can fix that.
The problem in your code is that ARG.get(0) returns a string, but the
fibo() function requires an int. This will work:
FUNC MAIN() int
IF ARG.size() != 0
IO.write(fibo(ARG.get(0).toInt()))
ELSE
IO.write("Falten arguments\n")
}
RETURN 0
}
--
MORTICIAN: What?
CUSTOMER: Nothing -- here's your nine pence.
DEAD PERSON: I'm not dead!
MORTICIAN: Here -- he says he's not dead!
CUSTOMER: Yes, he is.
DEAD PERSON: I'm not!
The Quest for the Holy Grail (Monty Python)
/// Bram Moolenaar -- B...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///