Snippet. Vala. Traverse Array Backwards

Here is how to traverse an array backwards in Vala:

int[] source = {1,2,3,4,5,6,7,8,9};
	    
for (int i=source.length; i> 0; i--) {
    stdout.printf(source[i-1].to_string()+"\n");
}

Example


Updated on: 03 Dec 2024