Jump to content
IGNORED

IF statements with more than 2 ANDs lose some boolean defs


Recommended Posts

Never questioned this, but, IF statements with more than 2 conditions have a hard time with boolean defs.

 

So, this fails:

 if !dark && world_xy = rkey_xy    && !owned_rkey    then _COLUP1 = _rkey    : gosub spr1_key    bank6

 

But this works:

 if !roomflags{0} && world_xy = rkey_xy    && !owned_rkey    then _COLUP1 = _rkey    : gosub spr1_key    bank6

 

Is this the intended behavior?

 

The bB page says this:

 

The NOT operator can only be used with statements that do not include a comparison token (<, >, =)

 

Are you sure the second one is working? Or is that another thing that changed over time and no one told us?

  • Thanks 1
24 minutes ago, Random Terrain said:

The bB page says this:

 

The NOT operator can only be used with statements that do not include a comparison token (<, >, =)

 

Are you sure the second one is working? Or is that another thing that changed over time and no one told us?

 

Thank you!  But, yeah.  I just triple checked the 3 conditions and their combinations:

 

dark (true/false)

rkey_xy (current value/any other coordinate)

owned_rkey (true/false)

 

I guess I got used to going back to the non defined version of a boolean value when debugging.  Didn't read well enough to understand it shouldn't work at all.

  • Like 1

While working on a bB program, I look at the AND/OR/NOT chart 50 billion times a day since I can't remember any of it:

 

https://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#and_or_not_chart

and_or_not.thumb.png.ebbee39072a6b3c176e7b2ff02f33f30.png

  • Like 1

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...
  • Recently Browsing   0 members

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