Equinox Online Help

Home

List expression and comma operators

The list expression and comma operators always appear together and are used to construct lists of values. You can use them in any expression, but it is usual to use them with a Switch ... End Switch, or If ... Then statement. Consider the following, which examines the contents of Age.

switch age
case 16, 18, 21
Alert "Significant age"
case <0, >150
Alert "impossible age"
end Switch

The construction < 0 is a list expression. A list expression always comprises a comparative operator (priority 11) and a data item. Using the If ... Then statement instead:

if age = 16, 18, 21 then
Alert "Significant age"
end if

The comma operator is effectively equivalent to the Or operator. Hence, the above If ... Then statement is identical to:

if age = 16 Or age = 18 Or age = 21 then
Alert "Significant age"
end if

This changes slightly if used in conjunction with the Not or <> operator. Consider the following expression:

if age <> 16, 18, 21 then ...

To interpret the comma as Or would be non-sensical, as the expression would always evaluate as True. Instead, Equinox interprets it as And. Hence, the above expression is equivalent to:

If age <> 16 And age <> 18 And age <> 21 then ...