![]() quick server pages |
Conditional expressionsThe #if, #elseif, and #while commands involve conditional expressions. Variables, constants, and function return values can be compared.SyntaxAll tokens must be separated by whitespace and must be on the same line. No other code may follow on the same line. Alphanumeric constants should be quoted, but the parser is not strict about this.Examples
Comparison operatorsQUISP supports the following comparison operators. Some operators have one or more alternatives that may be used if desired. Supported comparison operators include:
QUISP also provides the following operators (see also the examples above):
Alpha vs. numeric= and != can be used with any data. IN, !IN, INLIKE, and !INLIKE can also be used with any data (numerics will be treated as strings), so id in "20,28,35" is valid, as is id like "40*", even if id is always a numeric value. Numeric-only comparison operators are: > >= < <= INRANGE OUTRANGE.Case sensitivityThe = and != operators are case sensitive. The other operations are case insensitive. To do a direct case-insensitive comparison use LIKE instead of =.Wild card charactersWild card matching may be done using LIKE, !LIKE, INLIKE, and !INLIKE. Wild card characters are * which matches any number of any character, and ? which matches a single instance of any character. Matching is case-insensitive. Full-fledged regular expressions capability is not implemented, and use of the * character is limited to the following positions: *abc, abc*, ab*cd, and *abc*. ? may be used anywhere.CONTAINSThe CONTAINS operator allows comparisons against multiword fields or right operand are split into words (delimited by any whitespace or punctuation). If one or more words in the right operand is present in the left operand, the result is TRUE. Otherwise the result is FALSE.Compound conditionals, and precedenceA compound conditional is two or more conditionals that are connected using the AND and/or OR logical connectors:
Presidence: compound conditional expressions are evaluated by splitting into OR terms, and then evaluating each term starting with the leftmost. For example:
Unfortunately, this processing order cannot be altered by use of parentheses.
The provided operators such as IN, INLIKE, INRANGE and OUTRANGE
may be useful in eliminating lower-level ORs.
It may also be helpful to capitalize ORs to emphasize their precedence.
|
![]() quick server pages Copyright Steve Grubb |