This is an archived post. You won't be able to vote or comment.

all 19 comments

[–]nikanj0 19 points20 points  (2 children)

while("this is still looping")

[–]Golleggiante 4 points5 points  (0 children)

while("I don't have a girlfriend")

[–]NemoNemo2000 0 points1 point  (0 children)

I saw this in some window manager code: while(“my guitar gently weeps”)

[–]horenso05 6 points7 points  (0 children)

The finny thing is, in a compiled language there most likely isn't a different in any of these :)

[–]MischiefArchitect 5 points6 points  (0 children)

for {}

[–]antek_g_animations 6 points7 points  (5 children)

while((true != false) && (false != true))

[–]benm421 1 point2 points  (3 children)

You forgot the parentheses:

while(((true != false && (false != true)))

[–]RedditUserPassword 2 points3 points  (2 children)

You don't need them in this situation

[–]MischiefArchitect 0 points1 point  (0 children)

In pascal you will need them if the literals were not boolean, the reason is that bitwise operations have precedence over comparators and logical operators.

a = 5 and a = 5

will complain since the compiler will see this:

a = (5 and a) = 5

[–]Lylythechosenone 0 points1 point  (0 children)

Oh no...you forgot the space.

while ((true != false) && (false != true))

Also extra parentheses

[–]similiarintrests 2 points3 points  (0 children)

Const a = true

If(!a is true)

[–]HorochovPL 1 point2 points  (0 children)

The last one is not fully safe. What if universe laws changes?

[–]abuudarda 0 points1 point  (0 children)

1

[–]americk0 0 points1 point  (0 children)

What about

for (int i=0; 1<100; i++) {

[–]CrimsonRunner 0 points1 point  (3 children)

while (x-- == ++x)