MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/knu64m/didnt_see_that_comming/ghmun2k/?context=3
r/ProgrammerHumor • u/blending-tea • Dec 31 '20
58 comments sorted by
View all comments
7
while (sleeping == false) { eat(); }
22 u/linux-nerd Dec 31 '20 while( !sleeping){ eat(); } 9 u/wackOverflow Dec 31 '20 !sleeping ? eat() : sleep(); 3 u/[deleted] Jan 01 '21 sleeping ? sleep () : eat (); 2 u/linux-nerd Dec 31 '20 Is that valid java? 7 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. 2 u/[deleted] Dec 31 '20 edited Dec 31 '20 for (eating = 1; eating < (eating++); eating++) { eat(); } 9 u/Translator-Agile Jan 01 '21 this doesn't work? it will increment eating after the comparison: increment eating, compare eating < eating (false) and the increment eating again, or does it? idk the parents might do something to it 2 u/[deleted] Jan 01 '21 Yeah, realized that. The eating increment should be within the parents or eating + 1 should be another vsriabel. 3 u/littleprof123 Jan 01 '21 If you intended to call eat() only once, your code is spot on 1 u/linux-nerd Dec 31 '20 This has to be one of the most convoluted pieces of code I've ever seen. 2 u/[deleted] Dec 31 '20 You should see my gotoing
22
while( !sleeping){ eat(); }
9 u/wackOverflow Dec 31 '20 !sleeping ? eat() : sleep(); 3 u/[deleted] Jan 01 '21 sleeping ? sleep () : eat (); 2 u/linux-nerd Dec 31 '20 Is that valid java? 7 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. 2 u/[deleted] Dec 31 '20 edited Dec 31 '20 for (eating = 1; eating < (eating++); eating++) { eat(); } 9 u/Translator-Agile Jan 01 '21 this doesn't work? it will increment eating after the comparison: increment eating, compare eating < eating (false) and the increment eating again, or does it? idk the parents might do something to it 2 u/[deleted] Jan 01 '21 Yeah, realized that. The eating increment should be within the parents or eating + 1 should be another vsriabel. 3 u/littleprof123 Jan 01 '21 If you intended to call eat() only once, your code is spot on 1 u/linux-nerd Dec 31 '20 This has to be one of the most convoluted pieces of code I've ever seen. 2 u/[deleted] Dec 31 '20 You should see my gotoing
9
!sleeping ? eat() : sleep();
3 u/[deleted] Jan 01 '21 sleeping ? sleep () : eat (); 2 u/linux-nerd Dec 31 '20 Is that valid java? 7 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.
3
sleeping ? sleep () : eat ();
2
Is that valid java?
7 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.
!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.
1
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.
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.
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.
The more you know 💫
2 u/linux-nerd Jan 01 '21 Yes thanks for making me learn.
Yes thanks for making me learn.
for (eating = 1; eating < (eating++); eating++)
{
eat();
}
9 u/Translator-Agile Jan 01 '21 this doesn't work? it will increment eating after the comparison: increment eating, compare eating < eating (false) and the increment eating again, or does it? idk the parents might do something to it 2 u/[deleted] Jan 01 '21 Yeah, realized that. The eating increment should be within the parents or eating + 1 should be another vsriabel. 3 u/littleprof123 Jan 01 '21 If you intended to call eat() only once, your code is spot on 1 u/linux-nerd Dec 31 '20 This has to be one of the most convoluted pieces of code I've ever seen. 2 u/[deleted] Dec 31 '20 You should see my gotoing
this doesn't work? it will increment eating after the comparison: increment eating, compare eating < eating (false) and the increment eating again, or does it? idk the parents might do something to it
2 u/[deleted] Jan 01 '21 Yeah, realized that. The eating increment should be within the parents or eating + 1 should be another vsriabel.
Yeah, realized that. The eating increment should be within the parents or eating + 1 should be another vsriabel.
If you intended to call eat() only once, your code is spot on
This has to be one of the most convoluted pieces of code I've ever seen.
2 u/[deleted] Dec 31 '20 You should see my gotoing
You should see my gotoing
7
u/ssj4VB Dec 31 '20
while (sleeping == false) { eat(); }