# Actions

### Assigning Values

Most actions simply assign a value to an attribute.

> `$Color="red"`

Several actions may be combined, separated by a semicolon.

> `$Color="red";$BorderColor="white";`

To remove the value from the current note, restoring the inherited or default value, simply omit the value the follows the “=” sign.

> `$Color=;`

The conditional assignment operator |= will assign a value to an attribute only if that attribute’s value is currently false, zero, or empty.

> `$Priority |= "low"`

The conditional assignment operator &= will assign a value to an attribute only if that attribute’s value is not false, zero, or empty.

### Conditional Actions

A conditional action is performed only if a specified condition is satisfied.

> `if($DueDate<date("tomorrow")) {$Color="red";}`

Conditional actions may also specify what should be done if the condition is not satisfied.

> `if($DueDate<date("tomorrow")) {$Color="red";} else {$Color="green"}`

### Side Effects

If an action is simply an expression, the expression is evaluated and the result discarded. For example, the action

> `runCommand("open /Applications/iTunes.app")`

will ask your computer to open iTunes, and the action

> `notify("find concert tickets")`

will post a notice to your computer’s notification center.

### Repeated Actions

A repeated action is performed for every element in a list or set. For example:

> `$Result=0; $MyList.each(x){$Result=Result+x;}`

would take a list of numbers, add them up, and store the sum in $Result.

Repeated actions are uncommon.