[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

12.2.6.4 Comparison Operations

Comparison expressions compare operands for relationships such as equality. They return boolean values, i.e. true or false. The comparison operations are nonassociative, i.e. they cannot be used together as in:

 
# Wrong!
1 < $x < 2

Use boolean operations (see section Boolean Operations) to group comparisons together.

Comparison operations can only be used in conditional expressions.

This table lists all comparison operators in order from highest precedence to lowest (notice, however, the comment after it):

x = y

True if x is equal to y. C and AWK programmers, please note single equal sign!

x != y

True if x is not equal to y.

x < y

True if x is less than y.

x <= y

True if x is less than or equal to y.

x > y

True if x is greater than y.

x >= y

True if x is greater than or equal to y.

Operators = and != have equal precedence. Operators <, <=, >, >= have equal precedence.

Most operators are defined for all radtest data types. However, only = and != are defined for avlists. Using any other comparison operator with avlists produces error.

If x and y are of different data types, their values are first coerced to a common data type, selected using a set of rules (see section Conversion Between Data Types).


This document was generated by Sergey Poznyakoff on December, 6 2008 using texi2html 1.78.