DekGenius.com
Team LiB   Previous Section   Next Section
=

Syntax

integerVar is equal to 50

Synonyms

equal[s]

is

[is] equal to

Return value

boolean; true or false

Description

This operator tests whether two operands are equal and returns a true or false value. You can use the symbol = or the human-language versions (e.g., equals) interchangeably. You can also use any of the operators to test the equivalence of boolean values, lists, numbers, dates, strings, and other classes. Remember, AppleScript does not use = for variable assignment; it uses statements of the form:

set var to 50

Chapter 6, discusses AppleScript variables and assignments. This operator syntax allows the scripter to use very readable statements:

if a does not equal b then display dialog "inequality!"

Examples

50 equals "50" -- returns false

50 is equal to ("50" as integer) (* true since "50" is coerced to 50 prior to 
the equality test *)

"animal" is equal to "AniMaL" (* true if you do not enclose this statement in 
a considering case...end considering block *)

(8 div 3) = (8 mod 3) -- both expressions evaluate to 2 so true

{65,75} equals {65,(65 + 10)} -- true, you can compare lists
    Team LiB   Previous Section   Next Section