Gotos is an actively used design pattern.

?Years Old
  • Gotos ranks in the top 50% of entities I track
  • the Gotos wikipedia page
  • I have 11 facts about Gotos. what would you like to know? email me and let me know how I can help.

Languages with Gotos include basic, c, cpp

Example from basic:

10 REM This BASIC program shows the use of the PRINT and GOTO Statements.
15 REM It fills the screen with the phrase "HELLO"
20 PRINT "HELLO"
30 GOTO 20

Example from c:

// C/C++ program to check if a number is 
// even or not using goto statement 
#include <iostream> 
using namespace std; 
  
// function to check even or not 
void checkEvenOrNot(int num) 
{ 
    if (num % 2 == 0) 
        goto even; // jump to even 
    else
        goto odd; // jump to odd 
  
even: 
    cout << num << " is evenn"; 
    return; // return if even 
odd: 
    cout << num << " is oddn"; 
} 
  
// Driver program to test above function 
int main() 
{ 
    int num = 26; 
    checkEvenOrNot(num); 
    return 0; 
}

Example from cpp:

// C/C++ program to check if a number is 
// even or not using goto statement 
#include <iostream> 
using namespace std; 
  
// function to check even or not 
void checkEvenOrNot(int num) 
{ 
    if (num % 2 == 0) 
        goto even; // jump to even 
    else
        goto odd; // jump to odd 
  
even: 
    cout << num << " is evenn"; 
    return; // return if even 
odd: 
    cout << num << " is oddn"; 
} 
  
// Driver program to test above function 
int main() 
{ 
    int num = 26; 
    checkEvenOrNot(num); 
    return 0; 
}

Last updated September 6th, 2019