=

From Xojo Documentation

Revision as of 19:11, 19 November 2009 by WikiSysop (talk) (See Also)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Description

Used to determine whether one expression is equal to another or to assign a value to a property or variable. String comparisons are case-insensitive.


Syntax

result=expression1 = expression2

Part Type Description
result Boolean Returns True if expression1 is equal to expression2.
expression1 String, Number, Boolean, Color, or Object Any expression.
expression2 String, Number, Boolean, Color or Object Any expression.

result=value

Part Type Description
result Any The property, variable, array, or array element that is assigned value.
value Any The value assigned to result.


Notes

The data types of expression1 and expression2 must match. You can make comparisons between objects of any data type and between objects. If you compare objects, = compares their references, not their contents. For example, when you compare two FolderItems, = determines whether they have the same reference, not whether they point to the same file.

Use StrComp to do a case-sensitive string comparison.

You can use Operator_Compare to define comparisons for classes.


Examples

The following example tests whether two strings are equal.

Dim a,b as String
If TextField1.text <> "" and TextField2.text <> "" then
 a=TextField1.text
 b=TextField2.text
If a=b then
MsgBox "A is equal to B!"
 else
end if
else
MsgBox "Please enter values into both boxes!"
end if

See Also

>>=<<=, <>, and StrComp operators; Operator_Compare function; Operator precedence.