Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Returning a String from a function
#5
Okay, I remember. It's not a bug.
If you call a function in advance (not being declared yet) the compiler will asume it's a FLOAT function. You have to use DECLARE, to declare the function header in advance (like in C):
Code:
declare function test(n as Ubyte) as String

dim result as STRING
result = test(50)
print result

function test(n as UBYTE) as STRING
   return str(n)
end function
If you don't use DECLARE, everything (parmeters and return type) are supposed to be Float. So, the BUG in the compiler is the compiler should complain that your later function declaration doesn't match the expected return type.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)