# Operators

## 1. () + ()

Perform mathematical addition.

**Example:**

When HaloCode starts up, the LED ring will light up in the specified color order, and after 3 (1+2) seconds, goes off.

## 2. () − ()

Perform mathematical subtraction.

**Example:**

When HaloCode starts up, the LED ring will light up in the specified color order, and after 2 (3−1) seconds, goes off.

## 3. () * ()

Perform mathematical multiplication.

**Example:**

When HaloCode starts up, the LED ring will light up in the specified color order, and after 6 (2×3) seconds, goes off.

## 4. () / ()

Perform mathematical division.

**Example:**

When HaloCode starts up, the LED ring will light up in the specified color order, and after 3 (6÷2) seconds, goes off.

## 5. pick random () to ()

Pick a random number from the specified range.

**Example:**

When HaloCode starts up, the LED ring will light up in the specified color order, and after a random number (1-5) of seconds, goes off.

## 6. () > ()

If the value of the specified parameter is greater than the specified value, the report condition is met.

**Example:**

When HaloCode starts up, if the loudness is greater than 50, all the LEDs will light up red.

## 7. () < ()

If the value of the specified parameter is less than the specified value, the report condition is met.

**Example:**

When HaloCode starts up, if the loudness is less than 50, all the LEDs will light up blue.

## 8. () = ()

If the value of the specified parameter equals the specified value, the report condition is met.

**Example:**

When HaloCode starts up, if the rotation angle around the x-axis equals 360 degrees, the rotation angle will be reset.

## 9. () and ()

If both the conditions are met, the report condition is met.

**Example:**

When HaloCode starts up, if Wi-Fi is connected and HaloCode is being shaken, the LED animation "rainbow" will be played.

## 10. () or ()

If either one of the two conditions is met, the report condition is met.

**Example:**

When HaloCode starts up, if the button is pressed, or HaloCode is being shaken, the LED animation "rainbow" will be played.

## 11. not ()

The report condition is met when the specified condition is not met.

**Example:**

When HaloCode starts up, if the button is not pressed, the LED ring will light up in the specified color order.

## 12. join () ()

Join two specified character strings.

**Example:**

Report speech recognition result.

## 13. letter () of ()

Report the letter at specified position of a character string.

**Example:**

Report the first character of speech recognition result.

## 14. length of ()

Report the length of a specified character string.

**Example:**

Report the length of speech recognition result.

## 15. () contains ()?

If the specified character string contains the other specified character string, the report condition is met.

**Example:**

When HaloCode starts up, if the speech recognition result includes "red", all the LEDs will light up red.

## 16. () mod ()

Calculate the remainder (modular) of two specified numbers.

**Example:**

Calculate the modular of 5 dividing 2.

## 17. round ()

Round the specified number to nearest integer.

**Example:**

Round the value of the timer.

## 18. () of ()

Perform specific mathematical operation on the specified number. Mathematical operations include: abs (absolute value), floor, ceiling, sqrt (square root), sin, sos, tan, asin, atan, acos, ln, log, e^, and 10^.

**Example:**

Ceil the value of the timer.