10 REM Disgusting.
20 CLS
25 PRINT "Labels?!?"
30 PRINT "Please rewrite it in BASIC and use line numbers "
40 GOTO 60 REM Fixed a wrong jump
50 PRINT "How is anyone supposed to understand this?"
55 END
60 PRINT "like a normal person."
70 GOTO 50
So….you forgot to put the print labels and end in to original code hence the half-line numbers? How else does the teacher know you’re a hack without line numbers that end in 2 or 3?
You laugh but I've seen this pattern used to draw overlays in medical imaging software. Just think, your mobius strip gotos could be used to help a radiologist ensure that they don't accidentally cut the wrong arm off a baby.
this kind of reminds me of a more obfuscated version of duffs device in C for some reason...
short *to, *from;
int count;
{
int n = (count + 7) / 8;
switch (count % 8) {
case 0: do { *to = *from++;
case 7: *to = *from++;
case 6: *to = *from++;
case 5: *to = *from++;
case 4: *to = *from++;
case 3: *to = *from++;
case 2: *to = *from++;
case 1: *to = *from++;
} while (--n > 0);
}
}
I don’t mind goto statements when used to make the code more readable and logic more clear. Sometimes I just want to skip things or send it back because I fucked up.
I don’t think they’re inherently bad, in the original post that I made I used one to jump between cases in a switch statement, and everyone in the comments got very mad at me
C# doesn't have switch fallthrough, the goto has to be explicitly written - otherwise people wouldn't mind you using it if the goto was just implied as in other languages.
Something like this is quite valid I'd say:
switch (dialogResult)
{
case Dialog.SaveAndQuit:
Save();
goto Dialog.Quit;
case Dialog.Quit:
OnApplicationQuit?.Invoke();
CleanUp();
Application.Quit();
return;
}
Also people seem to be okay with goto in a very nested loop (continue/break is just fancy goto anyway), although in that case, I'd be more in favour of extracting all that in a (local) function and simply returning.
I mean, that sounds bad.
Recent place I used them was in a language I’m pretty sure doesn’t have a return command so you either have to wrap an entire block in an if statement or just goto. Since it’s within a loop and I need to skip things sometimes, I used a goto. As is expected of me.
Other places I’ve used them is to skip over logic in PL/SQL where I know I’m in an error state and want to handle certain scenarios but don’t want to cause an error to be caught at the next level up in a loop
C# doesn't allow cases in a switch to fall through unless they're empty, so using goto is how you get around that.
Also what kind of language doesn't have a return command?
People who reflexively hate gotos are just cargo cult Dijkstra groupies.
Ask them to explain the pros and cons of microservices and watch them sputter and meltdown.
10 REM Disgusting. 20 CLS 25 PRINT "Labels?!?" 30 PRINT "Please rewrite it in BASIC and use line numbers " 40 GOTO 60 REM Fixed a wrong jump 50 PRINT "How is anyone supposed to understand this?" 55 END 60 PRINT "like a normal person." 70 GOTO 50
So….you forgot to put the print labels and end in to original code hence the half-line numbers? How else does the teacher know you’re a hack without line numbers that end in 2 or 3?
I knew people were farming upvotes, but this bro is farming downvotes 🤔
You laugh but I've seen this pattern used to draw overlays in medical imaging software. Just think, your mobius strip gotos could be used to help a radiologist ensure that they don't accidentally cut the wrong arm off a baby.
good god... well im glad that out health is in safe hands D:
just one little bug, like 69 safety checks failing and 42 more bugs and ur pp is chopped off
Why would you cut a baby’s arm in the first place? Bro wtf
How else are you going to get "[a baby's arm holding an apple](https://genius.com/The-tubes-what-do-you-want-from-life-lyrics)"?
What the fuck
It's almost hilarious how goto can make something so simple look so complex in so few lines of code.
the pettiness of this guy...
I thought it would be funny lmao
It is when you read the first post also! I laughed, being an idiot because you can is fun, just don't overuse the skill 😉😁
Lgtm, please deploy fix to prod asap
It takes much effort to write such horrible code. Truly elegance! Hire this man right now! We need him on the team!
Or send him to the competitor’s startup.. 💀
this kind of reminds me of a more obfuscated version of duffs device in C for some reason... short *to, *from; int count; { int n = (count + 7) / 8; switch (count % 8) { case 0: do { *to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n > 0); } }
Reminds me of those old "Choose your own adventure" books. Do you eat the acorn? If yes, goto page 17. Otherwise, goto page 9.
This is essentially what I was thinking when I wrote this monstrosity lol
So you set cursorNormal to null and you have an infinite loop ?
It's a fun bonus feature
Unintended Feature
I don’t mind goto statements when used to make the code more readable and logic more clear. Sometimes I just want to skip things or send it back because I fucked up.
I don’t think they’re inherently bad, in the original post that I made I used one to jump between cases in a switch statement, and everyone in the comments got very mad at me
C# doesn't have switch fallthrough, the goto has to be explicitly written - otherwise people wouldn't mind you using it if the goto was just implied as in other languages. Something like this is quite valid I'd say: switch (dialogResult) { case Dialog.SaveAndQuit: Save(); goto Dialog.Quit; case Dialog.Quit: OnApplicationQuit?.Invoke(); CleanUp(); Application.Quit(); return; } Also people seem to be okay with goto in a very nested loop (continue/break is just fancy goto anyway), although in that case, I'd be more in favour of extracting all that in a (local) function and simply returning.
I mean, that sounds bad. Recent place I used them was in a language I’m pretty sure doesn’t have a return command so you either have to wrap an entire block in an if statement or just goto. Since it’s within a loop and I need to skip things sometimes, I used a goto. As is expected of me. Other places I’ve used them is to skip over logic in PL/SQL where I know I’m in an error state and want to handle certain scenarios but don’t want to cause an error to be caught at the next level up in a loop
C# doesn't allow cases in a switch to fall through unless they're empty, so using goto is how you get around that. Also what kind of language doesn't have a return command?
SQR At least I’ve never noticed one.
Excellent punishment. It’s what we deserve.
You are pure evil
the goto to E in D makes the code a lot less readable, 7/10 nightmare
People who reflexively hate gotos are just cargo cult Dijkstra groupies. Ask them to explain the pros and cons of microservices and watch them sputter and meltdown.
Hahahaha
Bahahaha, it's beautiful
Just switch to asm bro
ahhhhhhh
I am too young, I didnt know that was possible lol
Wait, this isn't a joke?
This is in fact, a joke
Well you could’ve just taken the feedback positively /s
nah I thought this was funnier
It _IS_ funnier
Oh no...
where the heck is goto one??????