The following warnings occurred:
Warning [2] Undefined array key 0 - Line: 1677 - File: showthread.php PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/showthread.php 1677 errorHandler->error_callback
/showthread.php 916 buildtree




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: 1 Guest(s)