Variables give a potent way to control lists. If you run this script:
♥list = Adam❚Eva❚John❚Mary ♥pos = 3 dialog ♥list⟦♥pos⟧
you will see
John in the resulting dialog box, because you told the robot to show the element with the index (position) received from the
♥pos variable. Since this variables equals
3, you'll get the third element from the list.
Of course, the value of the
♥pos variable doesn't have to be fixed. It's a variable after all and can depend on some operations and conditions, giving you lots of flexibility.
In the next lesson you will learn how to combine the power of lists, variables and loops.