Asteroid Shower
#11
For any IF statement, it's always implied <> 0 for a truth expression.

IF holdspace THEN ...  

The above is the exact same as if you had typed IF holdspace <>  0 THEN ...

Code: (Select All)
IF _KEYDOWN(32) = 0 AND holdspace THEN holdspace = 0

The above *should be* the same as typing IF _KEYDOWN(32) = 0 AND holdspace <> 0 THEN holdspace = 0.

The reason I say *should* is that sometimes those types of statements can get resolved in an unexpected order such as IF _KEYDOWN(32) = (0 AND holdspace) THEN....   If I was writing that line of code, I think I'd either write it as:

IF NOT _KEYDOWN(32) AND holdspace THEN holdspace = 0

Or, perhaps as:

IF (_KEYDOWN(32) = 0) AND (holdspace <> 0) THEN holdspace = 0

I'm a strong believer in taking the ambiguity out of any order of operations.  As written, I'd personally question if it's doing exactly what I'd be expecting it to do for me.  Wink
Reply


Messages In This Thread
Asteroid Shower - by mnrvovrfc - 12-22-2022, 12:08 AM
RE: Asteroid Shower - by Pete - 12-22-2022, 12:29 AM
RE: Asteroid Shower - by mnrvovrfc - 12-22-2022, 01:35 AM
RE: Asteroid Shower - by Pete - 12-22-2022, 01:49 AM
RE: Asteroid Shower - by grymmjack - 12-27-2022, 08:46 PM
RE: Asteroid Shower - by mnrvovrfc - 03-16-2023, 12:54 AM
RE: Asteroid Shower - by aurel - 03-16-2023, 08:14 AM
RE: Asteroid Shower - by aurel - 03-16-2023, 04:11 PM
RE: Asteroid Shower - by mnrvovrfc - 03-16-2023, 05:08 PM
RE: Asteroid Shower - by aurel - 03-17-2023, 07:54 AM
RE: Asteroid Shower - by SMcNeill - 03-17-2023, 11:30 AM
RE: Asteroid Shower - by aurel - 03-17-2023, 12:00 PM
RE: Asteroid Shower - by TempodiBasic - 03-23-2023, 01:25 AM
RE: Asteroid Shower - by bplus - 03-23-2023, 01:35 AM



Users browsing this thread: 6 Guest(s)