Confused of some code

Blitz3D Forums/Blitz3D Beginners Area/Confused of some code

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

> For a=0 To 9
> Cups(a)=0
> Next

It's the loop bit. The a variable is the key here.
Each loop it is different.
a=0 the way up to 9.
As it is placed inside Cups() it goes through all 0-9 of cups. a is confusing, but it could be anything.
You could do this

For badgers=0 To 9 
Cups(badgers)=0 
Next 


or

For blahblahblah=0 To 9 
Cups(blahblahblah)=0 
Next 


or even

For spoon=9 To 0 Step -1 
Cups(spoon)=0 
Next 


Which is the same as before but now the loop goes backwards starting from 9 and ending at 0. Adding Step -1 makes this happen as normally it is Step +1