Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LightSpeedC/e05197b38bd81641591d to your computer and use it in GitHub Desktop.
Save LightSpeedC/e05197b38bd81641591d to your computer and use it in GitHub Desktop.
[JavaScript] goto 文の実装例 ref: https://qiita.com/LightSpeedC/items/32c1d1d3c466b04b59d1
printf("init\n");
start:
printf("start\n");
goto next;
skip:
printf("skip\n");
next:
printf("next\n");
printf("exit\n");
var target;
target: for (;;) switch (target) {
case undefined:
console.log('init');
case 'start':
console.log('start');
// goto next;
target = 'next';
continue target;
case 'skip':
console.log('skip');
case 'next':
console.log('next');
default:
break target;
}
console.log('exit');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment