Friday, April 17, 2026

📚 Some ado about DONOTHING

For whatever reason, the "NOT" keyword has always been a kind of cognitive stick in my wheels.

"IF NOT ... THEN" just annoys the daylight out of me.

So, since I'm maintaining my own version of BASIC, why on earth would I put up with that?  Life is too short to put up with irritants.

Hence "DONOTHING".

I've been mocked for adding that statement, and I've received all kinds of suggestions on how to write code in such that I can avoid adding "DONOTHING" to my version of the BASIC programming language.

Pff.  I've been hobby-programming for 38 years, and I've been programming professionally for the last 30 years.  In that time, I've cranked out enough code to figure out what works for me and what doesn't.

Very likely, I'm the only one who would ever use the statement, and that's fine.  It is there for me.

Here's an example of DONOTHING, in a very silly program that shows a few other little nuggets about BAM's BASIC implementation:

SUB OpenTheDoor()
  LET DoorIsClosed = NOT TRUE
END SUB

SUB CloseTheDoor()
  LET DoorIsClosed = TRUE
END SUB

FUNCTION StatusOfDoor$()
  StatusOfDoor$ = "The door is " + IFF( DoorIsClosed, "closed.", "open.")
END FUNCTION

SCREEN _NEWIMAGE( 320, 24, 0 )
CALL OpenTheDoor()
PRINT StatusOfDoor$()
SLEEP 1
IF DoorIsClosed THEN DONOTHING ELSE CALL CloseTheDoor()
PRINT StatusOfDoor$()

Oh sure, we would not need DONOTHING if the program had a "DoorIsOpen" perspective.  As in "is the door open" instead of "is the door closed?"  It all depends on how you like to think of things.  For me, I prefer ask a question that has the state I want the door to be in, rather than ask a question with the state I do NOT want the door to be in.

Kind of like "have you taken your medicine?" versus "have you NOT taken your medicine?":

- "Have you not taken your medicine?"
- "Yes"
- "Yes what?"
- "Yes, I have not taken my medicine"
Ugh...





No comments:

Post a Comment

📚 Some ado about DONOTHING

For whatever reason, the "NOT" keyword has always been a kind of cognitive stick in my wheels. " IF NOT ... THEN " just...