Loop Flowchart

Hi guys,

I have to create this bot where the workflow asks user for his name and two-digit lottery
number and displays if he is a winner.

These are the tasks:
• Ask name of the user and two-digit lottery number
• Give the user five chance to enter the correct lottery number
• If entry is below 54 and above 64, display “Enter your lottery number. X chance remaining.”
Here, X is the number of remaining chances for user.
• If entry is between 54 and 64, display, “Congratulations User! You won the lottery.” Replace
User with the name of the user.
• If chances end before correct entry, display “Sorry, you lost. No more chances remaining

How would you do it?

Thanks :+1:

you can achieve it in couple of ways.

Simplest, you can use Input Dialogue Box to display the messages and take input from the user.

You can have a do while loop, the end condition should be boolExit = true

First take the first Input from the user. store it in intEnteredValue
Create a counter, intCounter
Create a variable to store your number of chances, intThreshold
Then in the Do While, have an IF condition to check if that integer is between 54 and 64, If yes then display the Congrats message in Mesaage box and make intCounter = intCounter + intThreshold
If no, then increase the intCounter

at the last stage of Do Whilw, add an IF condition,
If intCounter > intThreshold
in Then block add, isplay message box, no more option left and make boolExit = True

Hi,

Follow below steps:

1.ASSIGN count=5
Input Dialogue Box - str_UserInput
2.If cint(str_UserInput)>=54 and cint(str_UserInput)<=64
3. Then Message Box for “Congratulations User! You won the lottery.”
4. ELSE - Count=count-1
if count>0 then Message Box - You have count Chances left +( Input Dialogue Box ) connect to first Input Dialogue
else Message Box - Sorry, you lost. No more chances remaining

Thanks Rahul and Prathamesh. That was a great help :slight_smile:

1 Like

Hi again Prathamesh,

Sorry for being so annoying with this :tired_face:. but would you mind doing it on the actual studio and share with me to check what am I missing? Is giving me an error for some reason.

Thanks again

Sure, don’t worry

I am sharing the workflow for reference. Appreciate you gave a try.

Lottery.zip (2.8 KB)

Hi,

Please make changes as per ur need
QUIZ.xaml (14.8 KB)

Prathamesh.

Prathamesh you’re :star: !!

You’ve been very helpful.

Thank’s again for everything :slight_smile:

Most welcome!!!

You too.

Thank you so much for your time and help :wink:

Best wishes

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.