Hi,
Noticed that this works and compiles fine and results are unexcpected
function foo(a,b);
begin
result := a=b;
end;
begin
if foo(1,2) then
showmessage('foo1')
else ifFoo(2,2) then
showmessage('foo2')
else
showmessage('foo3');
end;
so program output is foo2.
this is with TatPascalScripter latest version 7.24.0.0
and even if I add ifFoo function to my code it's not called.
Very curious!
And it doesn't need the else. You can do it from the first if
iffoo(1,2) then
It works!
And if you declare:
procedure iffoo(a, b);
begin
showmessage('iffoo');
end;
function foo(a,b);
begin
result := a=b;
end;
then,
iffoo(1,2) then => will call the function iffoo(1,2); => will call the procedure
and ififfoo(1,2) then showmessage('wow'); => will call the procedure and then throw an error because of the invalid return type.