Search tutorials
Now you need to remember that you hadn't enough eggs so to keep the stuff you just popped in a variable is very simple:
groceries=["carrots","sausages","beans"]
groceries[0]="bacon"
groceries.push("eggs")
excess=groceries.pop()
trace(groceries)
trace(excess)
No real explanation needed just showing you you can do that.
Now what about the opposites of these codes, adding and removing from the beginning of the array, for that you would use the shift() and unshift() functions.
groceries=["carrots","sausages","beans"]
groceries[0]="bacon"
groceries.unshift("eggs")
excess=groceries.shift()
trace(groceries)
trace(excess)
| » Level Intermediate |
|
Added: 2004-10-03 Rating: 7 Votes: 19 |
| » Author |
| Cool |
| » Download |
| Download the files used in this tutorial. |
| Download (0 kb) |
| » Forums |
| More help? Search our boards for quick answers! |
-
You must have javascript enabled in order to post comments.


Comments
There are no comments yet. Be the first to comment!