IFNOT

Command: Test condition(s) and execute a block of code if valid (negative logic).

((PUBPRI))
  IFNOT Condition(s)
  -> IfNotStatement(s)
  ELSEIF Condition(s)

  -> ElseIfStatement(s) >…
   ELSEIFNOT Condition(s)
  -> ElseIfNotStatement(s) >…
  ELSE
  -> ElseStatement(s) >

  • Condition(s) is one or more Boolean expressions to test.
  • IfNotStatement(s) is a block of one or more lines of code to execute when the IFNOT's Condition(s) is false.
  • ElseIfStatement(s) is an optional block of one or more lines of code to execute when all the previous Condition(s) are invalid and the ELSEIF's Condition(s) is true.
  • ElseIfNotStatement(s) is an optional block of one or more lines of code to execute when all the previous Condition(s) are invalid and the ELSEIFNOT's Condition(s) is false.
  • ElseStatement(s) is an optional block of one or more lines of code to execute when all the previous Condition(s) are invalid.

 

Explanation

IFNOT is one of the three major conditional commands (IF, IFNOT, and CASE) that conditionally executes a block of code. IFNOT is the complementary (negative) form of IF.

IFNOT tests Condition(s) and, if false, executes IfNotStatement(s). If Condition(s) is true, the following optional ELSEIF Condition(s), and/or ELSEIFNOT Condition(s), are tested, in order, until a valid condition line is found, then the associated ElseIfStatement(s), or ElseIfNotStatement(s), block is executed. The optional ElseStatement(s) block is executed if no previous valid condition lines are found.

A "valid" condition is one that evaluates to FALSE for a negative conditional statement (IFNOT, or ELSEIFNOT) or evaluates to TRUE for a positive conditional statement (ELSEIF).

See IF for information on the optional components of IFNOT.

Unless otherwise noted, content on this site is licensed under the
Creative Commons Attribution-ShareAlike 4.0 International License.