From Wiki of ZZT
Jump to navigation Jump to search

#if is a built-in ZZT-OOP command which evaluates the state of a flag, conditionally executing another command if it is true.

#if can test the status of internal flags (alligned, blocked, etc.), as well as a set of user-assigned flags, of which ten can be active at a time.


#if <flag> [then] <command>


  • "then" is decorative and can be omitted.
  • The final command does not require a '#' symbol.

Chaining if Commands

Multiple #if commands can be chained together on one line to test more than one flag at once. The rightmost command will execute only when all preceding ifs evaluate to true, similar to a logical AND operator in other languages.

#if <flag1> if <flag2> <command>