Ultimately, all you need are labels and conditional jumps... Does JavaScript have goto?

@vaporeon_ after a little searching someone in 2009 made a preprocessor for the language that adds goto but the library can only be found in an internet archive page and the internet archive is currently down

@wallhackio I think the one time I had to use JavaScript, I found out that my specific use-case for goto in that particular program could be done with something called... Labelled branch? Labelled break? Something like that. Do you know what I'm talking about and what it's actually called?

@wallhackio Oh, never mind, æscling just told me that it's called a "labelled statement": glaceon.social/@aescling@cat.f

It can be used to break out of nested loops properly.

@vaporeon_ @wallhackio you can purrobably do cool nasty hacks with them since the labeled statement can seemingly just be an arbitrary code block

label1: {
// ...
}

but idk it seems a bit limited

Follow

@vaporeon_ @wallhackio like idk how you’d do the goto err; pattern with something like this

@vaporeon_ @wallhackio well.

let isErr = false;
err: {
if (isErr) {
// ...
} else {
// ...
isErr = true;
break err;
// ...
}
}

but that's terrible lol

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.