O'Reilly logo

DarkBASIC Pro Game Programming, Second Edition by Joshua R. Smith, Jonathan S. Harbour

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Advanced Logic Programming: Algorithms

Once you have mastered the basics of programming, you will develop your own unique programming style using techniques you have found to be useful. One such technique that I often use regularly is to short circuit a logic statement by reversing it and then doing away with an ELSE statement in most cases. For example, suppose I want to print a string onto the screen using the TEXT command, but I want to make sure the string contains a value first.

IF LEN(message) > 0
  TEXT 100, 100, message
ENDIF

Short-Circuit Logic

I like to use the term “short circuit logic” to describe this type of programming, because it is a descriptive term. When you perform a simple test and then exit out of a function when the test ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required