Alice Community

Alice Community (
-   How do I...? (
-   -   Lists (

ElectricKirby 06-22-2011 01:52 AM

Can I/How do I change the contents of a list at runtime?

reuben2011 06-22-2011 06:58 AM

Drag the list tile into the method editor. A pop-up should appear with various options. Use "insert..." to insert things into the list and "remove..." to remove things from the lists. Let me know if you need specifics on these. Another thing to remember is that the 1st item in the list has an index of 0, the 2nd item has a index of 1, and so forth. I don't see a "replace item at position <index>" function though (I guess I never used one.) There is a work around for this, just go:

remove <item> from position <index> of <list>
insert <item> at position <index> of <list>

You could make a replace method if you need to do a lot of replacing items in lists. Let me know if you need help. ;)

ElectricKirby 06-22-2011 08:09 AM

Haa, that's okay, I figured it out right after posting it

reuben2011 06-22-2011 12:31 PM

That's the nice thing about Alice, you tend to learn things yourself after fiddling with the tiles. ;)

All times are GMT -5. The time now is 06:49 AM.

Copyright ©2018, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.