Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Retrieve data depending on user input
Old
CTRstocks
Junior Member
 
Status: Offline
Posts: 4
Join Date: Dec 2011
Default Retrieve data depending on user input - 12-28-2011, 01:22 PM

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.
   
Reply With Quote
Old
Mr Kidnapper
Senior Member
 
Status: Offline
Posts: 442
Join Date: Feb 2011
Default 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.
   
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



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