I want to generate a number guessing game. Generate a random number between 1-10 and then guess using loops. The loops goes on till the correct number is guessed.
Hi @Trupti1
Welcome to UiPath
Try below easy steps.
- Assign →
randomNumber = new Random().Next(1, 11) - Assign →
userGuess = 0 - Do While (userGuess <> randomNumber)
- Input Dialog →
"Guess a number between 1-10"→ Store inuserInput - Assign →
userGuess = CInt(userInput) - If (userGuess < randomNumber) → Message Box
"Too low! Try again." - ElseIf (userGuess > randomNumber) → Message Box
"Too high! Try again."
- Input Dialog →
- Message Box →
"Congratulations! You guessed the right number."
if you found helpful mark as a solution.
1 Like
Welcome to the community!
You can use State machine type of workflow for this. Refer this tutorial.
2 Likes
2 Likes
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.

