Alice Community

Alice Community (
-   How do I...? (
-   -   Retrieve data depending on user input (

CTRstocks 12-28-2011 01:22 PM

Retrieve data depending on user input
For a project, I need to retrieve a name from a numbered list that corresponds to the number input by the user.

How do I associate a numeric world variable ("Rank") with the name of the item in that spot on the list? Do I do this with a list or array? How do I connect a number to a pre-determined string?

Any help would be appreciated, I have been reading the books but not finding anything that seems to address this.

Mr Kidnapper 12-28-2011 06:40 PM

Instead of lists, you use arrays. Take note:
Unlike lists, you can't add things willynilly.
Lists are meant so that you can go down it in order.
Arrays don't need to be in any particular order and you can pick from it arbitrarily, which means if you need to get a specific element from an array you can use your Rank number variable to return that element.

All times are GMT -5. The time now is 01:16 AM.

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