Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Negative STEP does not work (*solved*)
#2
LCD Wrote:Hi Boriel, I just trying to write some stuff in ZX Basic compiler 1.1.0, but I ran into some problems:
Code:
x=0
if x=1 then
  print "1"
else if x=0 then
  print "0"
end if

I got the message "Unexpected end of file", so if it is a part of FOR NEXT Loop, I got the message "Unexpected Token 'NEXT' <NEXT>". ELSE alone works, but I was sure, ELSE IF should work too, Or maybe I'm wrong?
[/code]
Hmmm. Every if should be closed with END IF, so another END IF is missing in your code. Try this way:
Code:
x=0
if x=1 then
  print "1"
else
  if x=0 then
     print "0"
   end if
end if
Maybe you were expecting to use ElseIf which has the same syntax you expected. I'll see if I can change the grammar to include it. Wink
Quote:Another one: the program does not accept Exponents: 2e4 (=2000) or similar.
Yes, I also find out yesterday. Will be fixed in 1.1.2.
Quote:And finally:
Negative STEP does not work with integers or long, only with floats or byte:
Code:
dim x as integer

for x=7 to 1 step -1
  print x
next x
Oops! :? This is very important. I will check this immediately.
Quote:The compiler is otherwise fantastic! Please continue your great work!
Thanks a lot for your feedback :!: I will replay when this is Fixed (ASAP).
By the way, version 1.1.1 is out. I suggest you to try it and check if this bug is still there, because I fixed many things.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)