C++ if condition not checked after goto
I'm working on a simplish game (this isn't the whole code, just the bit that I'm having issues with) and I've run into this issue; After the condition is furfilled, it goes back to the start and it offers me to reenter the string, however, whatever I enter, I just get 'Not Valid' . Does anyone know why? I'm using the GNU C++ Compiler . #include <iostream> #include <string> using namespace std; int main() { string command; mainscreen: cout << "blab"; getlinething: cin.ignore(); getline(cin, command); if (command == "task") { goto mainscreen; } else { cout << "Not valid."; goto getlinething; }