+ 1
Enquiries for if-else statement structure
I want to design an choice program for user. I have designed something like this, there is no last "else" because ans D is to exit the loop without printing anything. do { If ( ans == A) {} else if ( ans == B) {} else if (ans == C) {} } while ( ans != D); Is my design very weird ? Or there is any suggestion in terms of design. (please take note option D is just exit)
2 Réponses
+ 1
No, it just fine if you use equals() method
https://www.sololearn.com/Discuss/3016658/?ref=app
https://www.sololearn.com/discuss/3016143/?ref=app
0
Use switch cases..