Jump to content
IGNORED

Boolean operator syntax error


tdp
 Share

Recommended Posts

Hello Guys,

 

I have been using the following without issue:-

if x= 49 || x=57 then a=26

But if I use the following, I get a Syntax error:-

if x= c-2 || x=c+2 then a=26

I guessing I'm missing something really obvious here, but what have I done wrong. I have checked out http://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#boolean, and from what I can see, what I'm doing is good. For what I'm trying to do, it is important that the x value is compared against the result of the c value.

 

The weird thing is that the following compiles without issue:-

if x=c+1 then a=14

Is the problem that I'm doing x=c-2 followed by the boolean or?

Link to comment
Share on other sites

Thanks for the response Osgeld. Spaces is not the issue:-

if x = c - 5 || x = c + 5 then a=28

The above still fails to compile. I also tried:-

if x = (c - 5) || x = (c + 5) then a = 28

But still no cigar. Any further ideas?

Link to comment
Share on other sites

Thanks guys. Digging into the RT bBatari docs some more, I can see that OR (||) has more restrictions on it that AND (&&). Case in point:-

if player0x = c + 5 && player0y = d + 5 then a=30

The above compiles fine. Now, just swap the operator from AND to OR:-

if player0x = c + 5 || player0y = d + 5 then a=30

The above does not compile. Looks like there are stricter restrictions on OR, compared to AND. Still trying stuff.

Edited by tdp
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...