Hello everyone!

Release Date: 18 January 2026
Last Updated: 29 January 2026
Language version: 0.4.1

In this tutorial, I will explain the basics of the Cylium programming language.
First of all, you need to install the interpreter.


Basics

Create a file with the .cyl extension, for example main.cyl.
Write the following code:

proc main
    echo "Hello, World!"
    exit 0
end

Run it:

$ ./cylium main.cyl
Hello, World!

In Cylium, the proc main procedure serves as the entry point of the program, similar to int main in C/C++.
When the program is executed, the runtime starts by calling main.

The echo operator is used to display anything that can be converted to a string.

The statement exit 0 works similarly to return 0 in C/C++.
The exit operator stops program execution, and the number indicates the exit status:


Variables and Input

Lets create a program that greets the user by name.

We need to:
1. Read user input
2. Store it in a variable
3. Display it

Variables are created using the var keyword.
Constants (immutable variables) can be created using const.

To display a variable inside a string, use +.

Example:

proc main
    # `input` reads a line from standard input
    var name = input

    echo "Hello, " + name + "!"

    exit 0
end

Run the program:

$ ./cylium main.cyl
Batman
Hello, Batman!

Memory management

Cylium is a manual memory management language.
This means you must explicitly delete variables when they are no longer needed.

You can do this using the delete operator:

var name = "Joker"
delete name

A Little Bit of Math

Now lets read a number from the user and perform some calculations.

Cylium is a strongly typed language.
This means each variable has a specific type, and type conversion must be explicit.

Available types in Cylium:

When reading input:

var value = input

The variable value has the type string.
To convert it to a number, use the as operator:

var value = input
value = value as number

Now lets do some math:

proc main
    var value = input
    value = value as number

    value += 5
    echo "value = " + (value * 2) as string
    exit 0
end

Result:

$ ./cylium main.cyl
10
value = 30

You can also use:
- / for division
- % for modulo
- and other standard arithmetic operators


Conditions

Let’s solve an easy problem:

Two friends have bought X kilograms of candies.
Now they want to divide them equally.
Please help them! Display “YES” if they can, or “NO” if they cant.

What we need to do:
1. Read input into a variable
2. Convert the variable to a number
3. Check whether the number is odd or even
4. Display the answer

Full code:

proc main
    var candies = input
    candies = candies as number

    if candies % 2 == 0 
        echo "YES"
    else 
        echo "NO"
    endif

    exit 0
end

As you can see, conditions in Cylium work similarly to those in classic languages.

Now lets make the problem slightly harder:

Also display “?” if the friends don’t have any candies.

proc main
    var candies = input
    candies = candies as number

    if candies <= 0 
        echo "?"
    else if candies % 2 == 0  
        echo "YES"
    else 
        echo "NO"
    endif

    exit 0
end

Yet Another Problem

N friends came to a party, and everyone brought some candies.
How many kilograms of candies are there in total?

More formally, we need to calculate the sum of all input values.

Subtasks:
- Initialize a counter with zero
- Read N
- Create a loop from 0 to N
- Read a value on each iteration
- Add it to the counter
- Output the final result

Please try to solve this problem by yourself first!

Solution:

proc main
    var n = input
    n = n as number

    var counter = 0
    var i = 0

    while i < n
        var candies = input
        candies = candies as number
        counter += candies

        i += 1
    endwhile

    echo counter
    exit 0
end

For comparison, here is a solution in C++:

int main() {
    int n;
    cin >> n;

    int counter = 0;
    for (int i = 0, candies; i < n; i++) {
        cin >> candies;
        counter += candies;
    }

    cout << counter << '\n';
    return 0;
}

Procedures

Now lets talk about one of the most fundamental parts of the language - proc.

Procedures (also called functions or subroutines in other languages) are a way to encapsulate reusable code blocks.
They allow you to define a set of instructions once and call them multiple times with different arguments.


Declaration

A procedure is declared using the proc keyword followed by its name and optional arguments.
Inside the procedure, you can perform any operations you need.
Procedures end with the end keyword.

proc foo arg1 arg2
    echo "Work!"
    echo arg1 + arg2
end

In this example, foo is a procedure that takes two arguments (arg1 and arg2).
The procedure prints a message and then outputs the sum of the arguments.
Procedures can contain any number of statements and can use other procedures internally.


Usage

Once a procedure is declared, you can execute it using the call keyword followed by the procedure name and any arguments it requires.

call foo 5 10

This will output:

Work!
15

Example

proc add a b
    echo a + b
end

proc main
    call add 5 10
    call add 7 3
    call add 9 9
end

Output:

15
10
18

Procedure Scope and Memory Management

In Cylium, each procedure has its own local scope.
This means that any variables created inside a procedure exist only while the procedure is running.

When the procedure ends (reaches the end keyword), all local variables are automatically deleted and their memory is freed.

For example:

proc example
    var temp = 42
    echo temp
end

Here, temp exists only during the execution of example.
After the procedure finishes, temp no longer exists.
There is no need to manually delete local variables — the language handles it automatically.

This automatic cleanup helps prevent memory leaks and keeps your programs safer and easier to manage.


Vectors

A vector is a heap-allocated dynamic array that can store values of different types, be indexed, and grow or shrink at runtime.

You can initialize a vector in two different ways:

# An empty vector
var nums = vector
# A vector with initial values
var nums = 1, 2, 3, 4, 5

You can work with indexes:

nums[3] = 5
nums[3] += 4

Final Thoughts

Cylium is a minimalistic language built around clarity, control, and explicit behavior.
It takes ideas from low-level languages like C and Rust, while keeping the syntax clean and easy to follow.

The goal of Cylium is simplicity without hiding important details - especially when it comes to control flow and memory.

Thank you for your attention.

Now its your turn.
Try implementing the Fibonacci sequence in Cylium and explore how far you can go!


Article by the language author - Ztry8 (AslanD)

Licensed under CC BY 4.0