Ask for Age
You want to display age-dependent content.
You ask the user about his age, save it, check it and give the user an answer that suits his age.
- Create a variable named "Age" [[more about variables] (./building.md#variables)]
- For the conversation block that contains the question of age, create a link, which takes its age as a response and performs the action Store Value.
- In the dialog box when setting the action, select the variable "Age"
- Leave the value field empty, so that the entire user input is stored in the variable.
- In the conversation block after which age-dependent responses are displayed, add a new action in the Actions tab.
- In the dialog box, select the action Compare Value, "Age" as variable, a comparison operator, e.g. "Greater than or equal to (>=)", and a value as age limit, e.g. "13". The bot then checks whether the variable "Age" is greater than or equal to 13 with "Age >= 13".
- If the result of the action Compare Value ("age> = 13") is true, the action to which Comparison true points is executed. Create a new action of type Show Block via the + Action button after Comparison True and select the conversation block which should be shown to users, who are 13 or older. Similarly, create an action for Comparison False to show users younger than 13 another conversation block.