Get to know the programming language: Vala

Very fast and expert at building graphical interfaces!


Get to know the programming language: Vala


Vala is an object-oriented programming language, with syntax inspired by C#.

With a self-hosted compiler that generates code in C that uses GObject, it was created to be used in developing applications for GNOME, and was later adopted by Elementary OS.

In one of the videos we made on Performance Tests with Programming Languages, Vala was in 1st Place as the fastest in the Round 2 and in 3rd place in the ranking final second only to C++ and C, but it was ahead of languages such as: Perl and Rust.


Installation

To install the Vala programming language you can use your operating system’s package manager. Example on Ubuntu:

sudo apt install valac

The letter c at the end refers to the compiler!


Creating a Hello, World! in Vala

After the Vala compiler is properly installed, you can test Hello, World! with the code below:

Create a file name (example): main.vala

Note that the file extension is .vala

And include the code below:

void main() {
     print("Hello, World!\n");
}

To compile, use the valac command, but it may be that only this compiler is available along with the version on your system, for example: valac-0.56. So, this would be the command for you to compile:

valac-0.56 main.vala

If your system has another version, type valac and then press the TAB key for your terminal’s auto-complete to show the available version.

Automatically it will compile the binary: main, so to run it just use ./:

./main

For more information about Vala visit the official website.


gnome vala


Share


YouTube channel

Subscribe


Marcos Oliveira

Marcos Oliveira

Software developer
https://github.com/terroo

Related articles