Empty Array Elements
The ability to have array elements hold empty strings can become handy in many programming tasks. Let’s say that we have an array named score that has fives elements as shown below:
score = 80
score = 85
score = 90
score = 95
score = 92
If you want to wipe out the 90 score, you write:
score = “”
The two arrays, before and after this statement are shown in the Figure below. As expected, the statement score=”” only clears the contents of the third element of the score array; all other elements remain in their positions unchanged.
Figure: Illustrating what happens when we delete an element from an array
Let’s end with some critical thinking questions…
Why is this valuable? Why would you want to remove an element from an array? What could you do with the array that you couldn’t otherwise do?
Do you have any questions? Ask us! We’re full of answers and other fine things!
Head to the Small Basic forum to get the most answers to your questions:
And go to http://blogs.msdn.com/SmallBasic to download Small Basic and learn all about it!
Small and Basically yours
– Ninja Ed & Majed Marji