04-18-2010, 12:10 AM
Ok, you seems to have a bug in your code. ZX BASIC compiler is *case sensitive* by default. You have declared a function named stringIF (notice the uppercase F), but calls a different function named stringIf.
Also calling a function before it's declared automatically declares it as Float, so you're effectively, concatenating a float function with a string (The compiler should do a better work, and has a bug, anyway). If you declare the function FIRST (at the top), your program will work:
Anyway: The compiler has a bug. It should not allow you to declare stringIF as String if you have already called it in your program-
Also calling a function before it's declared automatically declares it as Float, so you're effectively, concatenating a float function with a string (The compiler should do a better work, and has a bug, anyway). If you declare the function FIRST (at the top), your program will work:
Code:
function stringIf(condition as uinteger,text as string) as string
if condition then
return text
else
return ""
end if
end function
dim a as ubyte
let a = 10
print "Yes: "+stringIF(a,"yes")+"..." ' ERROR: Cannot convert string to a value. Use VAL() function
print "Nothing: "+stringIF(0,"yes")+"..."
REM stop ' not needed
Anyway: The compiler has a bug. It should not allow you to declare stringIF as String if you have already called it in your program-