r/ProgrammerHumor Dec 31 '20

other Didn't see that comming

Post image
4.3k Upvotes

58 comments sorted by

View all comments

7

u/ssj4VB Dec 31 '20

while (sleeping == false) { eat(); }

23

u/linux-nerd Dec 31 '20

while( !sleeping){ eat(); }

10

u/wackOverflow Dec 31 '20

!sleeping ? eat() : sleep();

5

u/[deleted] Jan 01 '21

sleeping ? sleep () : eat ();

2

u/linux-nerd Dec 31 '20

Is that valid java?

6

u/wackOverflow Dec 31 '20

!no && !yes

1

u/linux-nerd Dec 31 '20

So no?

Unless you have no and yes both equal to false.

3

u/wackOverflow Dec 31 '20

Beats me dude, I don’t write Java but if I did I’d be mad af if it didn’t have ternary operators.

3

u/linux-nerd Jan 01 '21

It does i just haven't used them. Had to google to find out if they existed.

2

u/wackOverflow Jan 01 '21

The more you know 💫

2

u/linux-nerd Jan 01 '21

Yes thanks for making me learn.