In a Workflow for guessing a random number, i have used a while loop (guessing loop) to keep asking the input until the random number and input match.
For the input, i hav added a try catch which is surrounded in a do while loop with condition that the exception message is none, so that the input in one iteration of guessing loop is kept on asked until no exceptions are found.
I wanted to know if there is any other way to do the above to task instead of using nested loops or to perform a more optimized method.
What purpose is inner loop and try-catch?
If the try-catch is only for checking if input value is numeric, we can check it in advance using Int32.TryParse method etc.
The inner loop is used to ask the user to re enter the input when an exception occurs. The Try Catch is used for checking number is numeric and if its not null