iRules expression lab
Evaluate an expression the way expr and if do in an iRule and see every step: how each operand was read, numeric or text comparison, precedence, where && stopped, and == next to eq. Tcl 8.4 or iRules mode. Local, no network.
RéseauTry
Result 1integer
How precedence groups it
($x == $y)
Every operator with its operands in parentheses. Tcl applies the higher-precedence operator first, whatever the spacing.
Evaluation, step by step
$x == $y1integer- Compared as integers: 10 and 10.
$x012- Reads the variable
x.
- Reads the variable
$y10- Reads the variable
y.
- Reads the variable
The same operands under each comparison operator
| Expression | Result | How it compares |
|---|---|---|
$x == $y | 1 | Numbers when both sides read as numbers; otherwise text. |
$x eq $y | 0 | eq compares text only. |
$x < $y | 0 | Numbers when both sides read as numbers; otherwise text. |
$x > $y | 0 | Numbers when both sides read as numbers; otherwise text. |
Variables after the set commands
$x012$y10
Références
- F5 K6091: The version of Tcl used to develop iRules
- Tcl 8.4 manual: expr
- F5 iRules reference: Operators
- F5 K57410758: warning [use curly braces to avoid double substitution]
- F5 K15650046: Tcl code injection security exposure
- F5 iRules reference: HTTP::uri
- F5 iRules reference: HTTP::host
- Tcl 8.4.6 source code, tag core-8-4-6 on GitHub