While(true)

>while(true)

i got shouted at once for using while (!!!!!!value && (c = func(..)))

>while(1 == 1)

while(true):
print("OP is a faggot")

>#DEFINE true = false

while(true){
...
if(cond){
break}
}

break;

>while(1) is a syntax error

for (;;) {}

continue;

>goto

The white man's infinite loop.

volatile bool a = true;
while(a){


}

while (true) {
...
if (true) {
break;
}
}

do{

}while(cond("true"));

private boolean cond(String cond){
boolean cnd = false;
if(cond.trim().toUpperCase().equalsIgnoreCase("true"){
cnd= true;
}
if(cond.trim().toUpperCase().equalsIgnoreCase("false"){
cnd= false;
}
return cnd;
}
}

>for(;;)

while(System.getProperty("java.version").startsWith("1")) {}

return nigger;
while(false) {
printf("Nigger");
}

#define ever (;;;)
for ever { ... }

label1:
{ }
goto label1

>jnle label1

if (result==true) {
return true;
} else {
return false;
}

>goto
this triggers the autist

endtime = currentTime() + 10sec
do {
// A whole bunch of shit
} while (currentTime() != endtime)

For some reason that loop got regularly stuck in forever mode...

Is there a way to do this for real so that the condition is checked every expression instead of every loop? Without appending a macro to each expression. I'd love something like that for threads instead of just checking at arbitrary points if the flow should break or not.

>while(String.valueOf((new Boolean(true)).equals(Boolean.valueOf(Boolean.TRUE))) != "false")

wtf do you mean "for some reason"

You want it to break the instant the condition is true? It's a very bad idea for most programs, but assuming you know that, I'd implement a listener that runs concurrently.

void f(){
...
f();
}
f();

Sarcasm, my auti friend.

>It's a very bad idea for most programs
There was a specific time that I was working on an embedded device and the client wanted execution to stop IMMEDIATELY when a physical button was released, originally I had arbitrary stages that it would do then check the condition but the client wasn't pleased with this. What I ended up doing was writing a macro and appending it to every expression because I couldn't think of any other way to have it actually exit as soon as possible. They never complained about the finished product and it's been months now. I didn't like the solution I came up with but it worked, I've been curious if there was a better way since though.

>=
kys

I will use recursion next time then!

>What I ended up doing was writing a macro and appending it to every expression
Wew.

The way I implemented something similar with a larger scale robot was by using concurrency. I forgot how I implemented the listener and I'd have to dig through some years old code to figure out exactly how I did it, but it'd just outright stop the thread midway. I'm sure if I cared enough to google "interrupt listener" I'd get some SO results.

With embedded devices I'd say you should be able to use hardware interrupts for that. That's the fastest and cleanest way of doing it.

I'll look into it. I've never had to do something like that before. I don't think the platform supported threads either, there might have been some way to do coroutines. I remember that being an issue.

#define true (rand()&2 ? true : false)

Hardware interrupts don't need threads. They force your processor to stop doing what it was doing and start executing a predefined piece of code until this is either done, or perhaps another interrupt overrules this too. In the end it will return to the original program and continue running this as if nothing happened. It's made for situations like yours. The question is whether your system is able to use it. Many embedded systems run java these days, and I don't know if you can still easily use interrupts that way there. Last time I actually worked with them was still with 8 bit processors and assembly, then it was simple.

#define TRUE 1

while (TRUE) {
...
}


FTFY FAGGOT

Because there's no guarantee that it will exactly hit your end time. Change that != to

.text
_start:
.globl _start
mov $4, %eax
mov $1, %ebx
mov $txt, %ecx
mov $16, %edx
loop:
int $0x80
mov $4, %eax
mov $1, %ebx
mov $txt, %ecx
mov $16, %edx
jmp loop
.data
txt: .ascii "OP is a faggot.\n"

x = !!y;

I started using that, just break out when some condition is satisfied anyways

Gotos are patrician. You just don't understand them.

I agree OP.

start:
...
if (break_condition) goto end;
goto start;

end:
...


is much more aesthetic.

>


hello world

If you've ever encountered code written by someone else 20+ years ago you'd understand my autistic nature towards gotos.

while condition == True:

double nigger = -1;

while (1 < 2)

[1..]

The compiler will turn that into while(true) and skip evaluating the expression every loop.

Saw an Indian do this in 3rd semester Java.

reapeat "Oop is a faggot"

gotos are still used mainly in driver programming where you don't have exceptions like in a higher level language.
They provide a single exiting code and cleaner code for things like this:

int *a, *b;
a = b = 0;
a = malloc (...);
if (!a)
goto cleanup;
b = malloc (...);
if (!b)
goto cleanup;

do_stuff

cleanup:
if (a)
free (a);
if (b)
free (b);

This
would look like this without gotos:
a = malloc
if (a)
{
b = malloc
if (b)
{
Stuff

free(b);
}
free (a);
}

The more conditions for things that can go wrong and not being able to do 'Stuff' the more indented the code.

>tfw I'm not allowed to use loops in this video game engine I'm using.

Scripts have to be loaded on demand or 60 times a second and if you put a loop in there it'll lock up the game.

It's a pity because I like scripting with loops.

gotos can be pretty comfy if used properly. The problem lies in how easily they're abused and the awful result when they are.

Yeah, all gotos I've encountered have been ways of doing indefinite do loops...

nice bread

my php normie colleagues always try to pull of shit like this:

using paranthesis like crazy thinking it makes any difference (also assigning within conditions, fuck that)
>if (($foo = ($this->a()))) { .. }

Ok, I only program in higher level languages, so there's always a better option, but I'll take you at your word that they're the better option for driver programming.

At the end of the day, the assembly generated and ran by whatever language you use makes extensive use of gotos (jumps), and it is sometimes convenient to represent the structure in the C code. As has been mentioned they also implement the same functionality as exceptions (conditional jumps).

That can't be right

Kek

>>> l = [1, 2, 3, 4]
>>> while l:
... l.append(l.pop(0))

do {
if (cond) break;
...
} while(false);

goto is bad, alright?

Nothing wrong with using while(true)

>his language doesn't have the `loop` operator and labeled blocks
'outer: loop {
if condition {
break;
}
loop {
if condition1 {
break 'outer;
} else {
break;
}
}
}

here's some libstd code for ya

#include

static bool true()
{
return !1; /* I'm so random ^_^ */
}

int main(void)
{
while (true != true())
{
true ();
}
return false;
}

while(1 + (1 - (3 - 2) * (176-175))){
printf("Oy vey\n");
}

Disgusting syntax

compiler will optimize this, nigger

>!!!!!!

what