New course! Every coder should learn Generative AI!
Try a free lesson+ 3
goto performs a direct jump to a specific label without any condition:
#include <iostream>
using namespace std;
int main() {
goto label;
cout << "no";
label:
cout << "yes";
return 0;
}
Output: yes
Since the 1980s the use of goto-statements is criticized as leading to unmaintainable spaghetti code.