User Tools

Site Tools


unless

# $EPIC: unless.txt,v 1.2 2006/08/20 17:37:08 sthalik Exp $

Synopsis:

unless (<condition>) <then> unless (<condition>) { <then> } [{ <else> }]
unless (<condition>) { <then> } elsif (<condition>) { <then> } else { <then> }
unless (<condition>) { <then> } elif (<condition>) { <then> }
unless (<condition>) { <then> } else if (<condition>) { <then> }

Description:

UNLESS is the inverse of the IF command. If <condition> is FALSE then <then> is is executed. If <condition> is TRUE then any further else oe elseif conditions are parsed until a <condition> is found that is FALSE. Note that even though the word “elsif” and “elif” are used, that does not change that it is looking for a <condition> that is FALSE.

For all the other gory details, see the IF help file.

Examples:

 unless (1 == 1) {
    echo 1 == 1.  This is not executed, because 1 == 1 is TRUE
 } elsif (1 == 0) {
    echo 1 == 0.  This is executed because 1 == 0 is FALSE.
 } else {
    echo ha!  This is not executed because 1 == 0 is FALSE.
 }

History:

The UNLESS command first appeared in EPIC3.

unless.txt · Last modified: 2006/08/29 16:08 (external edit)