If This, Then That 🔗
Sometimes you may want to display a part of the program to
certain users. You can set what some of your users will see
keyword can work in conjunction with many other GuidedTrack
elements and keywords, such as variables, points, and the *set
keyword, as illustrated below.
*question: Do you prefer the mountains or the ocean? Mountains *set: mountainlover Ocean *set: beachbum Want to know what I think? *if: mountainlover Mountains are stupid. *if: beachbum I love long walks on the beach!
In the program above, users will be asked their preference for
the mountains or the ocean. By using the
keyword, you can remember this information about the user, and
use it to personalize the program for them later on. In this
example, users will see one of two phrases, depending on whether
their preference was set as "mountainlover" or "beachbum."
It's important to note where the tabs are used in the above
example. If you want to remember which multiple choice answer a
user selected, you must indent the
keyword below their selection. Whenever you use the
keyword, you always indent what the user will see next on the
line below the
You can also use the
keyword with math operations:
()parentheses to set operator preference
>=more than or equal to
<=less than or equal to
^to the power of
Here's an example using the
keyword, and some math operations.
*question: What number am I thinking of, between 1-10? *save: number *if: number = 5 Great job! *if: (number < 5) or (number > 5) You're wrong!
Here's another way you could write that last line, using "not":
*if: not number = 5 You're wrong!
The above is essentially saying, "If the variable
is something other than 5, display 'You're wrong!'."