> For the complete documentation index, see [llms.txt](https://docs.sannybuilder.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sannybuilder.com/language/instructions/built-in-commands.md).

# Built-in Commands

The following commands are built directly into the compiler and serve mostly as [syntactic sugar](https://en.wikipedia.org/wiki/Syntactic_sugar).

## INC

Increments the first parameter by the second one. The first parameter is a [variable](/language/data-types/variables.md).

```
Inc($IntVariable, $Value)
=
$IntVariable += $Value
```

The second parameter is equal to `1` if isn't specified.

```
Inc(1@)
=
1@ += 1
```

Since the version 3.06 it's possible to use the `++` operator that can be applied to variables and increments their value by one.

```
$var++
=
$var += 1
```

## DEC

Decrements the first parameter by the second one. The first parameter is a variable.

```
Dec($IntVariable, $Value)
=
$IntVariable -= $Value
```

The second parameter is equal to `1` if isn't specified.

```
Dec(1@)
=
1@ -= 1
```

Since the version 3.06 it's possible to use the `--` operator that can be applied to variables and decrements their value by one.

```
$var--
=
$var -= 1
```

## MUL

Multiplies the first parameter by the second one. The first parameter is a variable.

```
Mul($IntVariable, $Value)
=
$IntVariable = $IntVariable * $Value
```

The second parameter is equal to `2` if isn't specified.

```
Mul(1@)
=
1@ = 1@ * 2
```

## DIV

Divides the first parameter by the second one. The first parameter is a variable.

```
Div($IntVariable, $Value)
=
$IntVariable = $IntVariable / $Value
```

The second parameter is equal to `2` if isn't specified.

```
Div(1@)
=
1@ = 1@ / 2
```

## ALLOC

This function sets the offset of a [global variable](/language/data-types/variables.md#global-variables) at the global variable space that exists in the beginning of the `main.scm` header.

It's only meaningful for custom variables (e.g. `$text`) not defined in the `CustomVariables.ini`. [`DMA`-variables](/language/data-types/variables.md#global-variables) always get their offset based on the number in their names, e.g the variable `$40` always occupies four bytes at the offset `160` (40\*4).

The first parameter must be a global variable, the second parameter must be a positive integer number or zero.

```
Alloc($MyVar, 40) - the variable $MyVar will be compiled as $40
```

{% hint style="info" %}
See also `help\examples\alloc.txt`
{% endhint %}

## SQR

Multiplies the variable by itself.

```
sqr($var) 
=
$var *= $var
```

{% hint style="info" %}
The variable type has to be [declared](/language/data-types/variables.md#var-end-construct).
{% endhint %}

## RANDOM

This function generates a random number within the specified range.

```
$rnd = random(1, $high)
```

This function can be used for both integer and floating-point variables. The opcode is selected based on the type of the result variable (`$rnd` in this example).


---

# 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://docs.sannybuilder.com/language/instructions/built-in-commands.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.
