To see these examples in action, type them into the Command window.

// The usual numeric and string comparisons

? 3 < 4 // true

? "cat" > "dog" // false

// String comparisons demonstrate SET EXACT rules

set exact off

? "abc" == "abc" // Obviously true

? "abc" == "abc " // Trailing space in second operand is ignored: true

? "abc" = "ab" // 1st operand begins with the characters in the 2nd: true

? "abc" = "" // true by definition

? "" = "abc" // false

? "abc" # "" // false

? "" # "abc" // true

// Logical comparisons are redundant

valid = true

? valid == true // true, but so is

? valid // this

? valid == false // false, but it's simpler to

? not valid // use the logical NOT operator

// Date objects compare the date/time they represent

x = new Date( )

y = new Date( ) // Should be a few seconds later

? x < y // true, date/time in x is before y

x = new Date( "25 Sep 1996" )

y = new Date( "25 Sep 1996" )

? x == y // true: objects are different, but date/time is the same

// Other objects test for equality only

a = new Form( )

b = new Form( )

c = b

? a == b // false, different objects

? b == c // true, references to same object