# Assignment operators

You can use the assignment (`=`) operator to assign a value to a variable, as in the following:

    var password = "Sk8tEr";

You can also use the assignment operator to assign multiple variables in the same expression. In the following statement, the value of `a` is assigned to the variables `b`, `c` and `d`:

    a = b = c = d;

You can also use compound assignment operators to combine operations. Compound operators perform on both operands and then assign that new value to the first operand. For example, the following two statements are equivalent:

    x += 15;
    x = x + 15;

The assignment operator can also be used in the middle of an expression, as in the following:

    // If the flavor is not vanilla, output a message.
    if ((flavor = getIceCreamFlavor()) != "vanilla") {
    	trace ("Flavor was " + flavor + ", not vanilla.");
    }

This code is equivalent to the slightly more verbose code that follows:

    flavor = getIceCreamFlavor();
    if (flavor != "vanilla") {
    	trace ("Flavor was " + flavor + ", not vanilla.");
    }

The following table lists the ActionScript assignment operators:

Operator | Operation performed
`=` | Assignment
`+=` | Addition and assignment
`-=` | Subtraction and assignment
`*=` | Multiplication and assignment
`%=` | Modulo and assignment
`/=` | Division and assignment
`<<=` | Bitwise shift left and assignment
`>>=` | Bitwise shift right and assignment
`>>>=` | Shift right zero fill and assignment
`^=` | Bitwise XOR and assignment
`|=` | Bitwise OR and assignment
`&=` | Bitwise AND and assignment