At certain points in a conversation you may want your conversation AI application to exit or continue a loop. This where the Continue Loop and Break out of Loop actions can be used.
The Continue Loop instructs your conversational AI application to continue with the next iteration of the loop whereas the Break out of Loop action stops executing the current loop.
In this example you'll learn how to exit and continue a loop. We'll leverage previous knowledge such as capturing user input and creating and looping through an array. We'll use a prompt to ask the user if they want to see the next item in the array.
If the user supplies "Yes", the loop will continue and the next item in the array will be displayed.
If the user supplies "No", the loop will exit and the conversation is over.
To implement this perform the following steps:
Create an array with 3 items in it. You can recap on how to create an array here.
We need to loop through each item in the array and add a confirmation prompt to verify if the user wants to continue or exit the loop. To do this perform the following steps: