Thread: removeweapon()
View Single Post
  #9  
Old 07-10-2008, 02:02 AM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
Quote:
Originally Posted by Inverness View Post
Skipping over Stefan's posts usually isn't a smart thing to do. If you don't understand it then just think really hard about how arrays work.
Just noticed my previous post is a really misleading way of deleting half the list.

Anyway, similar method, different language but guaranteed to work:
PHP Code:
>>> foo = [1, "bar", False, ["baz", "crux"], 9]
>>> 
cruux = len(foo)
>>> for 
i in range(cruux):
...     print 
"Foo: " + str(foo[0])
...     
foo.remove(foo[0])
... 
Foo: 1
Foo
: bar
Foo
: False
Foo
: ['baz', 'crux']
Foo: 9
>>> foo
[]
>>> 
All assuming the precise functioning of this "special intelligent object" did not elude me.
Reply With Quote