Vala. How to Reverse a String

This snippet demonstrates how easy is to reverse a string in Vala. The reversing of the string is done by using the reverse method of the string object.

// Start string
string my_string = "Hello, world!";

// Reversed string
string reversed = my_string.reverse();

// Print reversed string
stdout.printf(reversed + "\n");

// Prints !dlrow ,olleH