Vala examples I

Some weeks ago, i was thinking about to write a vala tutorial. Finally, i’ve decided to write only vala examples. Easy vala examples that anyone can understand it only reading it once times (or twice times if you don’t undestand it the first time 😉 ).

The first example is the clasical “hello world” :


/* hello-world.vala */
/* valac -o hello-world hello-world.vala */

using GLib;

public class Sample : Object {
        public Sample () {
        }

        public void run () {
                stdout.printf ("Hello World\n");
        }

        static int main (string[] args) {
                var sample = new Sample ();
                sample.run ();
                return 0;
        }
}

Happy hacking !!

One thought on “Vala examples I”

  1. Hi,

    I am learning Vala too. 🙂
    Please keep on posting examples. I will be waiting for some covering the more obscure details in the official documentation.

    Thanks for your work.

Leave a Reply

Your email address will not be published. Required fields are marked *