> For the complete documentation index, see [llms.txt](https://glados.guillaume-hein.fr/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://glados.guillaume-hein.fr/features/operators.md).

# Operators

GoMelan supports many basic operators.

{% hint style="info" %}
In our language, operators are subject to the rules of operator precedence, ensuring calculations are performed in the intended sequence.
{% endhint %}

## Basic Operators in GoMelan

GoMelan supports various basic operators that can be applied to numeric types, such as Int and Float. It's essential to ensure that the types are consistent throughout the calculation.

{% hint style="warning" %}
Becareful, to apply these operators, all the types should be the same across the whole calculation.\
\
For example if you want to do

`var:`<mark style="color:red;">`Float`</mark><mark style="color:purple;">`=`</mark><mark style="color:blue;">`0.1`</mark>`+`<mark style="color:blue;">`2`</mark>`;`

Please consider converting your types\
`var:`<mark style="color:red;">`Float`</mark><mark style="color:purple;">`=`</mark><mark style="color:blue;">`0.1`</mark>`+ intToFloat(2);`
{% endhint %}

### **Arithmetic Operators**

* **Addition (+):**

  ```php
  result: Float = 2.5 + 3.8;
  ```
* **Subtraction (-):**

  ```php
  difference: Int = 10 - 4;
  ```
* **Multiplication (\*):**

  ```php
  product: Float = 4.0 * 2.5;
  ```
* **Division (/):**

  ```php
  quotient: Int = 15 / 3;
  ```

### **Comparison Operators**

* **Equal (==):**

  ```php
  isEqual: Bool = 5 == 5;
  ```
* **Not Equal (!=):**

  ```php
  notEqual: Bool = 10 != 5;
  ```
* **Greater Than (>):**

  ```php
  isGreaterThan: Bool = 8 > 5;
  ```
* **Less Than (<):**

  ```php
  isLessThan: Bool = 3 < 7;
  ```
* **Greater Than or Equal To (>=):**

  ```php
  isGreaterOrEqual: Bool = 6 >= 6;
  ```
* **Less Than or Equal To (<=):**

  ```php
  isLessOrEqual: Bool = 9 <= 10;
  ```

### **Logical Operators**

* **Logical AND (&&):**

  ```php
  result: Bool = true && false;
  ```
* **Logical OR (||):**

  ```php
  result: Bool = true || false;
  ```
* **Logical NOT (!):**

  ```php
  notResult: Bool = !true;
  ```
