11-16-2022, 06:21 PM
(11-16-2022, 06:04 PM)CharlieJV Wrote:(11-16-2022, 04:43 PM)SMcNeill Wrote: ...snip...
I love this article.
I had never thought about it: REM is a statement.
I knew it subconsciously via the pain using it at the end of a line after code because of the needed separator (":").
But I had never thought about it in the use of an IF ... THEN REM scenario. And I like it. I can see times in which I'd want to make a "do nothing in this condition" very explicit, and I like this approach. Totally floats my boat.
(Well, a "DO_NADA" statement would be more semantically jugular-grabbing, but REM is good enough.)
Thanks !
Glad to see people reading these and learning from them.
That last line of yours made me laugh out loud -- at myself! Believe it, or not, you'll find the following in a good bit of my personal code:
Code: (Select All)
SUB DoNothingAtAll
END SUB
The main reason I tend to have such a sub in a ton of my code?? For use with _RESIZE.
_RESIZE returns a value for us so we can make adjustments in our program when the user changes the size of the window. Only problem is, it reports ALL changes to the window size. QB64 tends to start, by default, with a SCREEN 0 text screen. So, naturally, once we place a statement like SCREEN _NEWIMAGE(800,600,32) in our code, it has to change size, triggering that _RESIZE flag...
And so, you'll see me with a lot of this type of code in my programs:
Code: (Select All)
SCREEN _NEWIMAGE(800, 600, 32)
IF _RESIZE THEN DoNothingAtAll
It's not a DO_NADA, but it's mighty dang close!!