How to avoid GOTO in C++
问题 I have read that GOTO is bad, but how do I avoid it? I don't know how to program without GOTO . In BASIC I used GOTO for everything. What should I use instead in C and C++? I used GOTO in BASIC like this: MainLoop: INPUT string$ IF string$ = "game" THEN GOTO game ENDIF 回答1: Usually loops like for , while and do while and functions have more or less disposed the need of using GOTO. Learn about using those and after a few examples you won't think about goto anymore. :) 回答2: Consider the