> For the complete documentation index, see [llms.txt](https://learn.pakronics.com.au/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learn.pakronics.com.au/primary/codey-rocky-ai-robot/block-reference/operators.md).

# Operators

### 1. () + () <a href="#id-1" id="id-1"></a>

Perform mathematical addition.

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-1-1.png)

**Example:**

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-1-2.png)

Press Button A. Codey's screen will display the result of "2 + 3".

### 2. () − () <a href="#id-2" id="id-2"></a>

Perform mathematical subtraction.

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-2-1.png)

**Example:**

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-2-2.png)

Press Button A. Codey's screen will display the result of "3 - 1".

### 3. () \* () <a href="#id-3" id="id-3"></a>

Perform mathematical multiplication.

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-3-1.png)

**Example:**

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-3-2.png)

Press Button A. Codey's screen will display the result of "2 × 3".

### 4. () / () <a href="#id-4" id="id-4"></a>

Perform mathematical division.

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-4-1.png)

**Example:**

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-4-2.png)

Press Button A. Codey's screen will display the result of "6 ÷ 2".

### 5. pick random () to () <a href="#id-5-pick-random-to" id="id-5-pick-random-to"></a>

Pick a random number from the specified range.

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-5-1.png)

**Example:**

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-5-2.png)

Press Button A. Codey's screen will display the image for a random number of seconds within the range of 1 to 10.

### 6. () > () <a href="#id-6" id="id-6"></a>

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

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-6-1.png)

**Example:**

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-6-2.png)

Shake Codey. If the shaking strength is greater than 10, Codey will play the sound "wow".

### 7. () < () <a href="#id-7" id="id-7"></a>

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

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-7-1.png)

**Example:**

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-7-2.png)

When Codey starts up, if battery level is lower than 50%, Codey's screen will display "low battery".

### 8. () = () <a href="#id-8" id="id-8"></a>

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

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-8-1.png)

**Example:**

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-8-2.png)

When Codey starts up, if the red value of the object detected equals 255, Codey's LED will light up red.

### 9. () and () <a href="#id-9-and" id="id-9-and"></a>

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

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-9-1.png)

**Example:**

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-9-2.png)

After starting up, Codey Rocky will keep moving forward at 50% power until red obstacle is detected.

### 10. () or () <a href="#id-10-or" id="id-10-or"></a>

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

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-10-1.png)

**Example:**

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-10-2.png)

When Codey starts up, Codey will play the sound "hello", if Button A is pressed or if being shaken.

### 11. not () <a href="#id-11-not" id="id-11-not"></a>

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

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-11-1.png)

**Example:**

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-11-2.png)

When Codey starts up, if there no obstacle ahead, Codey Rocky will keep moving forward at 50% power.

### 12. join () () <a href="#id-12-join" id="id-12-join"></a>

Join two specified character strings.

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-12-1.png)

**Example:**

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-12-2.png)

When Codey starts up, the screen will display "hi" and "morning" together.

### 13. letter () of () <a href="#id-13-letter-of" id="id-13-letter-of"></a>

Report the letter at specified position of a character string.

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-13-1.png)

**Example:**

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-13-2.png)

When Codey starts up, the screen will display the third letter of "morning".

### 14. length of () <a href="#id-14-length-of" id="id-14-length-of"></a>

Report the length of a specified character string.

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-14-1.png)

**Example:**

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-14-2.png)

When Codey starts up, the screen will display the length of "morning."

### 15. () contains ()? <a href="#id-15-contains" id="id-15-contains"></a>

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

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-15-1.png)

**Example:**

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-15-2.png)

When Codey starts up, if "apple" contains "a", Codey's screen will display "yes".

### 16. () mod () <a href="#id-16-mod" id="id-16-mod"></a>

Calculate the remainder (modular) of two specified numbers.

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-16-1.png)

**Example:**

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-16-2.png)

When Codey starts up, the screen will display the remainder of "9 ÷ 6".

### 17. round () <a href="#id-17-round" id="id-17-round"></a>

Round the specified number to nearest integer.

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-17-1.png)

**Example:**

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-17-2.png)

When Codey starts up, the screen will display the result of rounding 10.7.

### 18. () () <a href="#id-18" id="id-18"></a>

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^.

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-18-1.png)

**Example:**

![](http://docs.makeblock.com/codeyrocky/en/block-reference/images/operators-18-2.png)

When Codey starts up, the screen will display the square root of 16.<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://learn.pakronics.com.au/primary/codey-rocky-ai-robot/block-reference/operators.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
