0
How to deal with incorrect input data types
I'm trying to make a simple area machine. To make it marginally unbreakable, I want it to keep asking for an input if what's entered is not a number. I need this to happen for both length and width. Thanks! https://code.sololearn.com/c3uYAOoC739Q/?ref=app
1 Antwort
0
try{
......
}catch(the error that you want to catch ){....}
the normal flow of the code when it reach the input and that input isn't float will throw an error , so you can put try and catch block inside the loop .
and your code inside the try and when the error happens will catch it and execute the logic inside the catch .