I am a newbie , can somebody explains to me this simple For loop statement?

Roland

Member
Apr 28, 2008
56
0
6
This is a function who is supposed to remove an item from the store item.
I can't understand it. All I know from this function is that it wants to
remove only one item(_collection.splice(i, 1);) when it founds and
and the loops stops when he got the item to remove(break)
The all class was an Arry Class and there was an AddItem function
which I understand without any issue.

Public function removeItem(item:StoreItem): void {
var i:uint;
for( i = 0; i < _collection.length; i++) {
if (collection == item) {
_collection.splice(i, 1);


break;
}
}
(This an AS3 Function for beginner)
 
Back
Top