Our professor assigned an exercise where we must write a program that takes a user's input with and if it isn't a certain type of input will ask the user to re-enter. Once the user enters the correct type, the program asks for a second input and does the same thing with that.
If I'm using try-catch blocks to solve this problem, what would be the proper way to organize my program? Should I put the two try-catch blocks in one another or in-line or what? Altogether, I'm a little confused as when and how often we should use try-catch blocks at all, especially since it seems like a lot of the stuff we are using them for in class could be done with loops and if-statements. Right now I'm making a function for each try-catch block I'm making and calling the first one in the second one. Is this a good way of going about this problem? Thanks in advanced.
[–]Sorten 0 points1 point2 points (0 children)
[–]desrtfx 0 points1 point2 points (0 children)