





















































Most of us enjoy a good circus, carnival, or county fair. There's fun, food, and fortunes. Aah, yes, what would a fair be without the fortune-teller's tent? By the end of this article, you'll know everything you need to spin your fortunes and amaze your friends with your wisdom.
Before we start the first exercise, create a new project and add two sprites. The first sprite will be the seeker. The second sprite will be the teller. Choose any sprites you want. My seeker will be a clam and my teller will be a snowman. If you want to add a background, go ahead.
In order to have a successful fortune-telling, we need two things: a question and an answer. Let's start by defining some questions and answers:
To automatically add the next item in the list, press enter.
I'm certain you could come up with a hundred different questions to ask a fortune-teller. Don't worry, you'll get your chance to ask more questions later.
Did you notice that the new list we created behaved a lot like a variable? We were able to make the questions list private; we don't want our teller to peek at our questions, after all. Also, the list became visible on the screen allowing us to edit the contents.
The most notable difference is that we added more than one item, and each item corresponds to a number. We essentially created a numbered list.
If you work with other programming languages, then you might refer to lists as arrays.
Because the seeker's questions were contained in a list, we used the item block to provide special instructions to the say block in order to ask the question. The first value of the item block was position, which defaulted to one. The second value was the name of the list, which defaulted to questions.
In contrast, if we used a variable to store a question, we would only need to supply the name of the variable to the say block.
Create an answers list for the teller sprite, and add several items to the list. Remember, there are no wrong answers in this exercise.
We can use lists to group related items, but accessing the items in the list requires an extra level of specificity. We need to know the name of the list and the position of the item within the list before we can do anything with the values.
The following table shows the available ways to access a specific item in a list.