Relational operators are used to compare both strings and/or numerics.

Syntax

exp relational.operator exp |

Description

Relational operators are:

=

#

>=

<=

>

<

These operators first attempt to convert both operands into numerics. If successful, a numeric comparison is performed at the current precision. If unable to convert both operands into numerics, the operators convert both operands to strings and perform a left-to-right comparison.

The value returned is nonzero (true) or 0 (true).

NOTE |
These strings are considered nonnumeric only when used with the above relational operators: ".", "+", "-", "-.", "+.", and "". |

Example(s)

The result is 0.

print 3 = 2 |

The result is nonzero because 2 was converted into a string that comes before the string "dog" in alphabetical order.

print 2 < "dog" |

The result is nonzero (true). Although the first 3 characters of x are actually a string of characters, the = operator was able to successfully convert this into a number and do a numeric test for equality.

equ am to char(254) x = "623abc" print 623 = x[1,3] |

See Also

! Logical Operator, * Arithmetic Operator, * Statement, *= Assignment Operator, + Arithmetic Operator, += Assignment Operator, , Reserved Character, - Arithmetic Operator, -= Assignment Operator, /= Assignment Operator, = Assignment Operator, > Relational Operator, Arithmetic Expressions, exp() Function, le Relational Operator, Logical Expressions, loop Statement, lt Relational Operator, ne Relational Operator, Precedence, precision Statement, Relational Expressions, Reserved Characters, \= Assignment Operator, ^ Arithmetic Operator