I usually don’t post code tips but since I haven’t published anything in a while, I thought I’d post this tidbit on how to use Include items elegantly.
I use Include items extensively. You need Includes at the top of programs for EQUates, DIM, Common, and other compiler directives. Some people put Includes in the middle of their mainline code because it doesn’t interrupt other flow. And some people put Includes at the bottom. I tend to put all Includes at the top to make them easy to find. So how do we avoid having the code executed on entry? In the Include items I do this:
Because of the IF 0, Nothing in that code block can get executed with a fall-through. My mainline code just does a GoSub for everything that’s required. In my eye, this is more elegant than the following.
IF 0 THEN label1: *... return label2: *... return END
The problem with that is that you need a label that’s unique to every Include item. The IF 0 construct is exactly the same in every Include item.
GOTO SKIP label1: *... return label2: *... return SKIP: * continue here
Do you have a preferred or better way to organize Includes? Let me know.
I plan to post at least two other small tip articles on this topic very soon. Come back and check um out!