Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Returning a String from a function
#4
Ah! Further to this, it appears that successful (or not!) compilation actually depends on where the call is in the file.

If the call appears BEFORE the declaration then compilation will fail. But if it appears AFTER the declaration then compilation succeeds.

i.e. this version won't compile:
Code:
dim result as STRING
result = test(50)
print result

function test(n as UBYTE) as STRING
   return str(n)
end function

... but this remixed version will actually work okay:
Code:
function test(n as UBYTE) as STRING
   return str(n)
end function

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

This only seems to be true for String functions - functions that return numerics appear to work fine regardless of where the call is.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)