[Gambas-user] array declaration versus referencing array elements

kevinfishburne kevinfishburne at ...1887...
Wed Dec 16 05:58:43 CET 2009


I have some code:

PUBLIC myarray AS String[10000, 2]
...
myarray[x, 0] = stuff
myarray[x, 1] = morestuff
myarray[x, 2] = evenmorestuff

and receive an "out of bounds" error message when referencing the third
array element assignment (myarray[x, 2] = evenmorestuff).

I can only assume that the array declaration defines the total number of
elements and that referencing the array elements starts at zero. In other
possibly more confusing words:

PUBLIC myarray AS String[10000, 2] = 10000x2 total elements

and

myarray[x,y] = myarray[0-9999,0-1]

I think my confusion may have come from my old VB6 days with "OPTION BASE"
and all that crapola. Someone please confirm that GAMBAS works as I
speculated or let me know if I'm missing something. Thanks all.

-----
Kevin Fishburne, Eight Virtues
www:  http://sales.eightvirtues.com http://sales.eightvirtues.com 
e-mail:  mailto:sales at ...1887... sales at ...1887... 
phone: (770) 853-6271
-- 
View this message in context: http://old.nabble.com/array-declaration-versus-referencing-array-elements-tp26806307p26806307.html
Sent from the gambas-user mailing list archive at Nabble.com.





More information about the User mailing list