## Assignment

The assignment operator is a colon followed by an equals sign (:=).

##### Example

    //Assign the Number value of 10 to the variable x
    x := 10;
    //Assign the String value of "hello" to the
    //variable named greeting
    greeting := "hello";

The equality operator (=) is used to check when two values are equal. A common error is to use the equality operator when the assignment operator is actually intended. This can generate a mysterious error message or no error message at all since it is often syntactically correct to use the equality operator. For example:

`greeting = "hello";`

The above formula checks if the value held by the variable greeting is equal to the value "hello". If it is, then the expression's value is True, and if is not then the expression's value is False. In any case, it is a perfectly correct Crystal syntax expression (assuming that the greeting is a String variable).

Seagate Software, Inc. http://www.seagatesoftware.com Please send comments to: techpubs@seagatesoftware.com