Is there a way to skip to a line of code if a condition is satisfied?

Is there a way to skip to a line of code if a condition is satisfied?

e.g
if(true)
{
|||skip to line|||
}


>inb4 install gentoo

yeah it's called a function call you gibbering fucktard.

GOTO exists in C# :^)

>function call

what the fuck is that

t. script kiddie

Jmp. But it's considered one of the worst practiced to use it. There is always something better,

goto PAJEET;
...
PAJEET:
throw new Exception();

This. Don't fucking use goto, any academic would fail you instantly.

Why? I have never felt even a little inclined to use a goto

'Continue' or 'break'

Look those up.

What's with all these retarded questions being posted on Sup Forums lately. Fuck off already

if(condition is not satisfied){
line of code;} you fucking retard

bump

Why not do
if (!true)
doThing;

Literally

>Sup Forums is NOT your personal tech support team or personal consumer review site.
You're showing your colours.

you can't actually be serious? holy fuck read a book.
private void OpIsAFaggot(){
//do shit in here
}

//other code
if(condition){
OpIsAFaggot();
}
read a book

gotit bitches ty

DESIGNATED

What?
Are you touched in the head or something?

How about you organize your code you piece of shit. If some piece of code is utilized more than once, make it a function.

There's a daily programming thread to post this in, or stupid questions thread.
If you ask stupid questions, questions that are easily answered by just reading a book, you get sucked.

tfw fucked up function call and just wrote a straightforward program a few weeks ago in a test

it happens. At least in your case you, I'm assuming, know what one is and had a brain fart. In OPs case he can't even bother to learn anything about the topic

Yes, it's called "goto".
While there are many scenarios where loops, conditions and function calls are much better, there are also some cases where goto is legitimately useful.
Unfortunately, retards have misinterpreted "using goto instead of if or loops a huge problem for readability, so don't do that" as "OH MY GOOOOOOODD IF THERE'S EVEN ONE (1) GOTO IN YOUR PROGRAM, IT TURNS INTO AN INCOMPREHENSIBLE, BUGGY MESS THAT WILL DESTROY EVERYTHING; NEVER USE GOTO! NEVER! IT'S THE DEVIL!"

this is why university exists.

What are you talking about? This is on the same level as advice like "don't write functions more than 10 lines long." It's completely contrived advice for people in their first month of programming to prevent them from writing terrible code. Once you know what you're doing, feel free to use goto. Go uses goto many times in the standard library implementation. I used it in writing a lexical analyzer generator for my Master's which would build a directed graph representing the lexer and then compile that to a state machine consisting of labels for states and goto for transitions. There is absolutely nothing wrong with goto if you use it in a reasonable manner.

I used goto exactly once, during my first year of uni. It was a nice way to get out from a complex tangle of ifs and for loops I wrote, but today I wouldn't have written that pile of crap in the first place.

TL;DR goto is a noob way for noob programmers to make their noob code work.

I guess the fact that I capitalized "master's" in my excitement might seem pretty douchey but my point still stands. Don't worry about using goto once you're proficient at programming.

Why would you use gotos instead of an array of function pointers for a FSM?

In some instances the functions wouldn't be inlined, even if the pointers were const. By using goto in the emitted code, I guaranteed no frames were pushed during the lex