Loop
while
The writing of a loop is as follows:
@Event('start')
start() {
nb = 0
while (nb < 10) {
> Total : { nb }
> Give me a number
Prompt()
nb += :text
}
> Total : { nb }
> Finish !
}The scenario will be as follows:
[Chatbot] Total: 0
[Chatbot] Give me a number
[User] 3
[Chatbot] Total: 3
[Chatbot] Give me a number
[User] 4
[Chatbot] Total: 7
[Chatbot] Give me a number
[User] 6
[Chatbot] Total: 13
[Chatbot] Finish!
for ... of
The for ... of loop allows you to browse a table:
It also works with a string, a number, and an object:
Last updated
Was this helpful?