On 7/15/2010 1:45 PM, Robert Powell wrote:
>Both of the above multi-dimensional array declarations work as
intended, but they do not seem to be global.
Is this what you are trying to do?
int [,] arr;
public void main(string [] args) {
arr = new int[3,4];
arr[0,0] = 1;
arr[1,1] = 2;
stderr.printf("%d:%d\n", arr[0,0], arr[1,1]);
}
Hope that helps
Thanks, Robert! That's exactly what I was trying to accomplish, but I was
trying to do it all at compile-time.
Hot diggety! I'm about to write a chess program in Genie! :-)
Here's Robert's example translated from Vala to Genie:
[indent=4]
//int [,] arr;
arr : array of int[,] // declare array name with global scope
//public void main(string [] args) {
init
//arr = new int[3,4];
arr = new array of int[3,4] // allocate the array
arr[0,0] = 1; // initialize it
arr[1,1] = 2;
stderr.printf("%d:%d\n", arr[0,0], arr[1,1]); // print it
//}
I want to make certain I am understanding this correctly:
1. All multi-dimensional arrays in Vala/Genie *must* be allocated at
run-time,
not at compile-time
2. Optionally, the multi-dimensional array name can be declared a global
name
Is this correct?
Ron
_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list