Vala
From Mario Fan Games Galaxy Wiki
| Vala |
|---|
| Basics |
| Intermediate |
| none |
| Advanced |
| none |
| Add to this template |
Vala is a programming language with a syntax similar to C#.
Hello World example
using GLib;
public class Hello : GLib.Object {
public static int main (string[] args) {
stdout.printf ("Hello world!\n");
return 0;
}
}Explanation
using GLib;
We want to use things from namespace GLib. This row is optional -- the compiler includes it anyway.
public class Hello : GLib.Object {
Now we create a new class that is derived from GLib.Object. Every class should derive from it.
public static int main (string[] args) {
The main entry point of every Vala program is called 'main'.
stdout.printf ("Hello world!\n");
Self-explanatory. '\n' means a new line.
return 0;
0 means that nothing has failed.
} }
Closing the braces.