Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Operators ANDALSO

Author
Message
RanQor
19
Years of Service
User Offline
Joined: 8th Jun 2007
Location:
Posted: 24th Jul 2010 19:07
I cannot find a "ANDALSO" type operator in the documentation. Is there anything similar to it so that when the first condition is false, the second condition isn't evaluated?

For example, I would like to do the following:


As you can see, using just an AND, the SPRITE X command will cause the program to exit raising an exception(if the sprite doesn't exist). I know I could nest two if statements, but I was hoping there was a less messy way to do this.
Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 24th Jul 2010 19:09
Would be nice, but I don't think there is any other way than nesting, unfortunately.

Scraggle
Moderator
23
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 24th Jul 2010 19:18
This will perform as you are hoping:




RanQor
19
Years of Service
User Offline
Joined: 8th Jun 2007
Location:
Posted: 24th Jul 2010 19:22
That's a bummer. I hate nesting.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Jul 2010 20:41
There's a direct equivalent of what you want for AND (AND with shortcut evaluation):


There is no short equivalent of 'OR with shortcut evaluation'.

Login to post a reply

Server time is: 2026-07-25 05:32:39
Your offset time is: 2026-07-25 05:32:39