...
The following are examples of if statements using the equal comparator, EQ:
Panel |
---|
Html bobswift |
---|
<pre>
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
</pre>
|
|
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 |
---|
Html bobswift |
---|
<pre>
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
</pre>
|
|
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 |
---|
Html bobswift |
---|
<pre>
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
</pre>
|
|
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 |
---|
Html bobswift |
---|
<pre>
if 8 GT 0
print msg="8 is greater than 0"
end
</pre>
|
|
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 |
---|
Html bobswift |
---|
<pre>
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
</pre>
|
|
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 |
---|
Html bobswift |
---|
<pre>
if $(filename.length) GE 9
print msg="The filename is longer than 8 characters"
end
</pre>
|
|