bool :gt ( mixed $ARG , … )
bool :> ( mixed $ARG , … )
Takes any number of arguments. Performs a comparison between the rightmost pair of elements, then the second-rightmost, et cetera. Checks if element on left is greater than the one on the right.
Returns TRUE
if all comparisons are deemed true, or FALSE
if any of the comparisons is deemed false.
The table below contains rules for comparing values. Note that these rules are often non-symmetrical; swapping the values may yield a different result. The row contains the type of the first (left) value in pair, while the column contains the type of the second (right) value in pair.
NIL | bool | bin | oct | int | hex | float | string | array | dict | |
---|---|---|---|---|---|---|---|---|---|---|
NIL | Always TRUE | Always FALSE | ||||||||
bool | Always FALSE | TRUE if left val is TRUE and right one is FALSE. | If bool is TRUE, it's converted to 1, or 0 otherwise. This value is then compared with the number. | If string is true or contains a non-zero number, it is treated as TRUE. This value is then compared with the boolean. | Always FALSE | |||||
bin | Always FALSE | If bool is TRUE, it is converted to 1, or 0 otherwise. This value is then compared with the number. | TRUE if left value is greater than the right one. | Float is truncated and then compared with the number. | String is converted to number (with regard to base). This value is then compared with the number. | Always FALSE | ||||
oct | ||||||||||
int | ||||||||||
hex | ||||||||||
float | Always FALSE | Float value is truncated and an int-like comparison is performed. | Float is truncated and then compared with the integer. | TRUE if left value is greater than the right one. | String is converted to float, and this value is then compared. | Always FALSE | ||||
string | Always FALSE | If string is true or contains a non-zero number, it is treated as TRUE. This value is then compared with the boolean. | String is converted to number (with regard to base). This value is then compared with the number. | String is converted to float, and this value is then compared. | TRUE if left string comes after right one (ASCII-wise). | Always FALSE | ||||
array | Always FALSE | Always FALSE | Always FALSE | Always FALSE | Always FALSE | Always FALSE | ||||
dict |
# :gt example. :set &NUM i0 :read &NUM !if :gt $NUM i100 :writeln s'Ermahgerd, NUM > 100.' !fi
wikistrona zmodyfikowana 2014/0601/2317