Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
concatenation of a str and a str function result (*solved*)
#4
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:
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-
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)