Skip to content

Variables

Sami edited this page Oct 30, 2025 · 4 revisions

Variables in kong

Declaration and initialization

In KongLang, you have to precise the type for each variable you create. Here's an exemple of a Integer called num and a String called str:

Int num = 67;

String str = "six-seven";

You can also create arrays and vectors which can contain multiple values of the same type:

Int[2] my_array = [6; 7];

Float<2> my_vector = <6.7, 6.7>;

We also handle Tuples, Tuples are used to store multiple items in a single variable.

Tuples are used to store multiple items in a single variable.

|Int, String| my_typle;

my_typle|0| = 6;
my_typle|1| = "7";
print(my_typle|0|); //-> 6
print(my_typle|1|); //-> 7

Operations

You can operate multiple operations between different types like substractions, sums, multiplications, divisions etc...

Int a = 6;
Int b = 7;

print(a + b); //-> 13
print(a - b); //-> -1
print(a * b); //-> 42

Clone this wiki locally