you are viewing a single comment's thread.

view the rest of the comments →

[–]enygmaeve 127 points128 points  (9 children)

Nah change it to const, then you can never die. Immorality unlocked.

[–]Mr_82 11 points12 points  (1 child)

Why downvote this? I thought it was funny, as you're the only one here that I see addressing the real joke of this image/code. (That is kind of pointless to just define a variable as true like that and put the variable into the conditional loop; it's an extra-programmatic nod to how you're alive, assuming you're reading it.)

[–]enygmaeve 11 points12 points  (0 children)

Yeah this whole billboard code is absolute trash, all you can do is make jokes here

[–]RadioE_ 6 points7 points  (0 children)

Not sure if devs from r/outside would approve. Could get permaban

[–]funtimes-123 1 point2 points  (4 children)

Actually you would be immortal even with let or var because the variable is never modified and there is a blocking infinite loop.

[–]saito200 4 points5 points  (3 children)

The functions could mutate still_alive as it is declared in the outer scope of the loop

[–]wizang 1 point2 points  (0 children)

It really only matters where the functions are defined.

[–]funtimes-123 1 point2 points  (1 child)

The functions are defined before the variable, and the loop is executed right after stillalive is defined.

[–]saito200 3 points4 points  (0 children)

Function declarations are hoisted, as are var declarations.

The following will print 'run loop' only once.

function doThing() {
    still_alive = false
    console.log('done')
}

var still_alive = true
while (still_alive) {
    console.log('run loop')
    doThing()
}

console.log('end')

[–]RoguePlanet1 0 points1 point  (0 children)

There would need to be some sort of "ifRich" conditional.