tranleduy2000 / pascalnide

Pascal Compiler for Android
91 stars 25 forks source link

False error in a recursive function #22

Closed nikelsad closed 6 years ago

nikelsad commented 6 years ago

I've got an error in a recursive function in a place where it should get itself a value that it should return. The error states about wrong number of arguments. But to give a value to a function one should assign it to the name of the funct. without any arguments. On a desktop this code works as it should.

function fib(n: Integer): Integer;
var f:Integer;
begin
  if n < 1 then fib:= fib(n+2)-fib(n+1)
    else if n > 2 then fib:= fib(n-2) + fib(n-1)
      else fib:=1;
end;
tranleduy2000 commented 6 years ago

Thanks for report bug.

tranleduy2000 commented 6 years ago

Fixed in latest commit