Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The following are examples of if statements using the equal comparator, EQ:

Panel
if $(filename) EQ myfile.txt
print msg="The name of the file is myfile.txt"
end*

if 8 EQ $(_lastrc)
print msg="The last command resulted in an error"
end

if $(filename.exists) EQ yes
print msg="The filename variable exists"
end


Anchor
NE
NE
NE - Not Equal

The not-equal comparator, NE, evaluates to true if the left-hand value is not the same as the right-hand value. As with the equal comparator, EQ, alpha character comparisons are case insensitive.

The following are examples of if statements using the not-equal comparator, NE:

Panel
if "C:\Program Files\Universal" NE $(mydir)
print msg="This is not the Stonebranch application directory"
end

if 8 NE 0
print msg="This will always print as 8 is not equal to 0"
end

if $(filename.exists) NE no
print msg="The filename variable exists"
end


Anchor
LT
LT
LT - Less Than

The less than comparator, LT, evaluates to true if the left-hand value is less than the right-hand value. The less than comparator performs a numeric comparison.

The following are examples of if statements using the less than comparator:

Panel
if 0 LT 8
print msg="0 is less than 8"
end

if $(_rc) LT 8
print msg="No errors have occurred"
end

if $(filename.length) LT 8
print msg="The length of the filename is less than 8"
end


Anchor
GT
GT
GT - Greater Than

The greater than comparator, GT, evaluates to true if the left-hand value is greater than the right-hand value. As with the less than comparator, LT, the comparison is between two numeric values, as shown in this example:

Panel
if 8 GT 0
print msg="8 is greater than 0"
end


Anchor
LE
LE
LE - Less Than or Equal

The less than or equal comparator, LE, is similar to the less than comparator, LT, except that it evaluates to true if the left-hand value is less than or equal to the right-hand value, as shown in these examples:

Panel
if 8 LE 8
print msg="8 is less than or equal to 8"
end

if $(filename.length) LE 8
print msg="The length of the filename is less than or equal to 8"
end


Anchor
GE
GE
GE - Greater Than or Equal

The greater than or equal comparator, GE, is similar to the greater than comparator, GT, except that it evaluates to true if the left-hand value is greater than or equal to the right-hand value, as shown in this example:

Panel
if $(filename.length) GE 9
print msg="The filename is longer than 8 characters"
end