03-04-2011, 11:59 AM
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:
... but this remixed version will actually work okay:
This only seems to be true for String functions - functions that return numerics appear to work fine regardless of where the call is.
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.