May-30-2024, 08:51 AM
I want to catch an input error and allow the user to correct it.
Input error correction.
|
||||||
May-30-2024, 08:51 AM
I want to catch an input error and allow the user to correct it.
May-30-2024, 09:10 AM
It is a pretty common task. Can you post the code that currently reads the user input where you want to catch and correct the error?
« We can solve any problem by introducing an extra level of indirection »
(May-30-2024, 09:10 AM)Gribouillis Wrote: It is a pretty common task. Can you post the code that currently reads the user input where you want to catch and correct the error? The following code takes the user input only as HH:MM otherwise an error occurs and the program stops. I would like to allow the user to be able to re-enter the input without the program terminating.
Larz60+ write Jun-07-2024, 11:25 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button. Tags have been added this post. Please use BBCode tags on future posts.
Jun-07-2024, 11:26 AM
Please post code using the bbtags. Makes it easier to help.
Is this what you are trying for? Added a try block
I welcome all feedback.
The only dumb question, is one that doesn't get asked. My Github How to post code using bbtags Download my project scripts
Jun-07-2024, 12:59 PM
I took the liberty and rewrote your code a little
I welcome all feedback.
The only dumb question, is one that doesn't get asked. My Github How to post code using bbtags Download my project scripts | ||||||
|