Computer Science Canada [Tutorial][Blitz] Arrays |
Author: | jonos [ Fri Feb 20, 2004 4:36 pm ] | ||||
Post subject: | [Tutorial][Blitz] Arrays | ||||
>>Introduction Well this is my first tutorial for Blitz Basic. I started learning it around 3 days ago, and its really fun. I will try to use proper grammar, sentence structure, spelling, and use of capitals to make this easy to understand. >>Part 1 Many of you will already understand and know what arrays are, but for those who do not, an array is kindof like a group of variables all under the same name, which can be accessed. Arrays are very useful for holding similar types of data, like names of people in your class, like the ages of these people, etc. What some people visualize an array as looking: [][][][][] etc, with the little boxes being an element. >>Part 2 In Blitz Basic arrays are declared by:
**Note: an array can be any data type ($,%,#), not %. An example of this would be:
This would make an array with 5 elements (the "slots" in an array), with a data type of integer. You may have noticed that you can't just declare an array like a variable (leaving the Dim part out), and this is because of some unknown reason which is not known by me. Im sure shorthair or Cervantes can add stuff to this (like initializing the array, I don't know how to do that). Also, I'm not sure about 2 dimensional/3 dimensional arrays. I hope you liked my tutorial, I hope I didn't make myself seem too much of an idiot. Have fun in blitz. |
Author: | Cervantes [ Fri Feb 20, 2004 5:18 pm ] | ||||||
Post subject: | |||||||
dim.. like declaring any type of var in Visual Basic nice tutorial. Allow me to add my bit ------------ With large arrays, its no help having an array if you have to call them individually. So we use the beloved For loop. Here is a lovely example.
However, if the user enters the number of names he wants to input, then you have to declare the array like so
and then for using that array:
Thanks shorthair |
Author: | shorthair [ Fri Feb 20, 2004 5:31 pm ] | ||
Post subject: | |||
This Is from My Target Game This takes in the values of the mouse sensitivity for later use , it shows the taking in of an interger
|
Author: | jonos [ Fri Feb 20, 2004 8:23 pm ] |
Post subject: | |
nice job everyone. i was going to do the whole for loop initializing but i had to go to work. this is becoming an awesome forum. Does anyone know about two dimensional or three dimensional arrays in blitz. I've never really used one, but its good to know. |
Author: | Cervantes [ Fri Feb 20, 2004 9:03 pm ] | ||
Post subject: | |||
From playing around I learned that you declare 2d arrays like so
Similar to Turing |
Author: | jonos [ Fri Feb 20, 2004 9:33 pm ] |
Post subject: | |
so 3 dimensional arrays would dim a% (3, 3, 3) |
Author: | polygon001 [ Fri Jun 20, 2008 4:08 pm ] |
Post subject: | RE:[Tutorial][Blitz] Arrays |
Hmmm well i still don''t get arrays much. Nor do I get types. I don't get how people visualize jars in boxes. And i'm pretty sure this is important stuff so help me out. |