Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
46 lines (33 sloc) 998 Bytes
description
Math, concatenation, etc.

Operators

Increment/Decrement Operators

The increment and decrement operators are just like in any other language. These operators can be in the form of a prefix or a postfix to a number variable.

Example

{% code-tabs %} {% code-tabs-item title="example_increment_decrement.cb" %}

var i = 1;

print(i++); // Postfix, prints 2
print(++i); // Prefix, prints 2

print(--i); // Prefix, prints 3
print(i--); // Postfix, prints 2

{% endcode-tabs-item %} {% endcode-tabs %}

Arithmetic Operators

Arithmetic operators are pretty straightforward. Just use them as if you were writing a math equation.

Example

{% code-tabs %} {% code-tabs-item title="example_arithmetic.cb" %}

var a = 1;
var b = 2;

println(a + b); // Addition, prints 3
println(a - b); // Subtraction, prints -1
println(a / b); // Division, prints 0.5
println(a * b); // Multiplication, prints 2

{% endcode-tabs-item %} {% endcode-tabs %}

You can’t perform that action at this time.