Re: arays in bgt, please let me understand them

I'll try to explain...
I hope that I don't explain this in such a way that will confuse you even more, but arrays are very simple.
Think of arrays as lists of items. If you have a list of things to do you write them down, voice-record them, whatever, but it's a list either way.
This could be applied to arrays.
string[] test;
We just asigned a new variable(of type 'array') and called it test.
Now in our main function we do the following:
test.insert_last("eat breakfast");
test.insert_last("Get ready");
test.insert_last("go to work");
//and on we go with our day.
We now have thre elements in our array, and you can check by doing something like:
alert("test size", "We must do "+test.length()+" things in the morning");
Getting a certain element can be just as easy, as we only need to pass the index or the number, at which the item is stored in memory.
Remember that arrays are 0 based, meaning that the first index when initially adding to an array is 0 and not one.
So if you want to access the "go to work" element, it is the number 2 and not the number 3.
So we do:
string last_action=test[2];
alert("Ok", "The last thing you must do is "+last_action);

I hoped that helped you out. Let me know if you're getting confused at a certain point.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Meatbag via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Meatbag via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : ivan_soto via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Meatbag via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Meatbag via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : rory-games via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Meatbag via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Meatbag via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Jaidon Of the Caribbean via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : rory-games via Audiogames-reflector

Reply via email to