Timeline for Two methods to prompt the user to enter the width and length of a rectangle
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 13, 2017 at 5:32 | comment | added | Rocket Pingu | Either way, you'd have to check if the input is valid twice: one for inside the loop; one for the loop condition just like the accepted answer. | |
Oct 13, 2017 at 5:24 | comment | added | 200_success |
while(isInvalid(input)) is very clumsy. Not only do you artificially initialize input to an invalid value to force it to enter the loop the first time, you also have a redundant isInvalid(input) rest inside the loop. You would be better off with a do-while loop.
|
|
Oct 13, 2017 at 4:06 | history | edited | Rocket Pingu | CC BY-SA 3.0 |
Fixed code.
|
Oct 13, 2017 at 3:52 | comment | added | Rocket Pingu | Oh wait, I didn't see that part. Lemme rework my code. | |
Oct 13, 2017 at 3:44 | comment | added | Gerrit0 | Your reworked code abandons the error handling the OP includes presumably for good reason. This probably isn't a good idea. | |
Oct 13, 2017 at 3:39 | history | answered | Rocket Pingu | CC BY-SA 3.0 |