Hello everyone!

Release Date: 18 January 2026
Last Updated: 6 July 2026
Language version: 0.6.0

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


Basics

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

func main() -> int
    echo("Hello, World!")
    return 0
end

Compile and run it:

$ ./cylium main.cyl
$ ./main.exe
Hello, World!

On macOS and Linux, you may need to make the compiler executable first: chmod +x cylium

In Cylium, the func main() -> int 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 return statement terminates program execution and returns an exit status to the operating system, similar to return in C/C++.
Common exit codes:


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 declared using the type name syntax.
Constants (immutable variables) can be created using const.

To display a variable inside a string, use +.

Example:

func main() -> int
    # `input()` reads a line from standard input
    string name = input()

    echo("Hello, " + name + "!")

    return 0
end

Run the program:

$ ./cylium main.cyl
$ ./main.exe
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:

string 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:

string value = input()

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

string value = input() as int

Now lets do some math:

func main() -> int
    int value = input() as int

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

    return 0
end

Result:

$ ./cylium main.cyl
$ ./main.exe
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:

func main() -> int
    int candies = input() as int

    if candies % 2 == 0 
        echo("YES")
    else 
        echo("NO")
    end

    return 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.

func main() -> int
    int candies = input() as int

    if candies <= 0 
        echo("?")
    else if candies % 2 == 0  
        echo("YES")
    else 
        echo("NO")
    end

    return 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:

func main() -> int
    int n = input() as int

    int counter = 0
    int i = 0

    while i < n
        int candies = input() as int
        counter += candies

        i += 1
    end

    echo(counter)
    return 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;
}

Functions

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

Functions are a way to encapsulate reusable code blocks.
They allow you to define a block of reusable code that can be called multiple times with different arguments and return a value.


Declaration

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

func foo(int arg1, int arg2) -> void
    echo("Work!")
    echo(arg1 + arg2)
end

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


Usage

Once a function is declared, you can execute it using the function name and any arguments it requires.

foo(5, 10)

This will output:

Work!
15

Example

func add(int a, int b) -> int
    return a + b
end

func main() -> int
    echo(add(5, 10))
    echo(add(7, 3))
    echo(add(9, 9))
    
    return 0
end

Output:

15
10
18

Procedure Scope and Memory Management

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

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

For example:

func example() -> void
    int temp = 42
    echo(temp)
end

Here, temp exists only during the execution of example.
After the function 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.


Arrays

A array 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 array in two different ways:

bool[] way1 = [true, true, true]

bool[] way2 = [3; true]

You can work with indexes:

nums[1] = false || true
nums[2] = true

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