Initialize Arrays at definition?

BlitzPlus Forums/BlitzPlus Beginners Area/Initialize Arrays at definition?

Alaric(Posted 2007) [#1]
Is there any way to initialize an array when you define it? I'm trying to make a chess program and I want to store each of the possible moves that every piece can possibly make into an array (please don't tell me a better way to make the program, I'm sure that this isn't the best way, but I'd like to try it out anyways). Here's an example of what I mean, which doesn't work.




Matty(Posted 2007) [#2]
I don't think there is a way in blitzplus (or b3d) that you can specify the array contents upon initialisation.

However you can use data statements or load from a file if that helps.


Andy_A(Posted 2007) [#3]
In Blitz, arrays are automatically 'Global'. Like Matty said you can use DATA statements containing the values to load. Using the 'RESTORE' statement allows you to load different data values (moves) into the same array.

Here's an example: