Languages Features Calendar CSV Lists Blog About Sponsor Add Language
GitHub icon



Gotos are a feature.

It performs a one-way transfer of control to another line of code; in contrast a function call normally returns control.

Languages without Gotos include Nim, Slope

Languages with Gotos include C, C++, BASIC, Jule

Example from C, 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 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 Jule:
goto a_label
generators-feature.html 路 gotos-feature.html 路 homoiconic-feature.html

View source

PLDB - Build the next great programming language 路 v2022 Day 33 Docs Build Acknowledgements Traffic Today Traffic Trends Mirrors GitHub