Freigeben über


Small Basic Arrays: Indexing Operator

Concept: To indicate that an identifier is an array, you use the indexing operator []. For example, if you write a statement such as age[1]=30, Small Basic understands that you want to create an array named age and assign the element at index 1 a value of 30. The index of array may be any expression. For example, if N=2, and M=3 in this statement:

arr[ 2 * N + M ] = 0

That's a pirate's array! Arr!!!

And it's a valid Small Basic statement; it sets the seventh element (since N=2 and M=3) of the array (arr) to zero. This is equivalent to writing this: 

arr[7] = 0

  

Go to https://blogs.msdn.com/SmallBasic to download Small Basic and learn all about it!

  

Small and Basically yours

- Ninja Ed & Majed Marji

Comments