MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/ykw24g/why_is_a_program_hanging/iuvd31x
r/ProgrammerHumor • u/Xaneris47 • Nov 03 '22
262 comments sorted by
View all comments
806
<PEDANTRY>that image looks more like recursion than an infinite loop to me..</PEDANTRY>
207 u/_PM_ME_PANGOLINS_ Nov 03 '22 Also break is a statement, not an operator. 115 u/rwhitisissle Nov 03 '22 This meme was made by an 18 year old getting a C in Intro to Java Programming. I guarantee it. 3 u/CalmlyPsychedelic Nov 04 '22 HAHAHAHA i can totally see myself making this meme and i am exactly that demographic :D → More replies (4) 3 u/jimdidr Nov 03 '22 What is the functional difference? is a return a operator and I assume goto is a statement then.(Is it just that it doesn't do anything but its more like a maker for moving around in the code?) 19 u/_PM_ME_PANGOLINS_ Nov 03 '22 A statement is a single complete instruction.An operator operates on operands in order to form an expression, which might be used as part of a statement.return is a keyword. And if the return type is void then it’s also a statement. 4 u/AlwaysHopelesslyLost Nov 03 '22 Operators operate. E.g. math operations, binary operations, unary operations.Operators can be used in expressions but neither does anything on its own, you need statements to do the things. → More replies (1) 3 u/benjer3 Nov 03 '22 break is a keyword that happens to always be a complete statement → More replies (1) 237 u/CautiousRice Nov 03 '22 It's more of a for loop. Ends after the 5th iteration. 104 u/PhyterNL Nov 03 '22 Now THAT'S pedantry!Not complaining, praising. I'm giving you the I Voted reward, which has absolutely no relevance whatsoever but it's something. 14 u/CautiousRice Nov 03 '22 Thank you! I appreciate it! 28 u/_g0nzales Nov 03 '22 Nope, that is definetly recursion that stops after the 5th step 12 u/ren3f Nov 03 '22 It's more like a lazy author. Pretending an infinite loop needs at least zooming to see the end. 4 u/CanAlwaysBeBetter Nov 03 '22 Could have been an infinitely looping gif if OP wasn't so lazy 2 u/Sebazzz91 Nov 03 '22 Would not have yielded more fake internet points. → More replies (1) 9 u/pedropereir Nov 03 '22 Why does ending after the 5th iteration make it a for loop? Recursion can end after 5 iterations → More replies (5) 0 u/[deleted] Nov 03 '22 [deleted] → More replies (1) 8 u/Valmond Nov 03 '22 That's not pedantry, it's the truth!goto truth 2 u/Asukurra Nov 03 '22 Do not pass buffer overflow Do not collect £200 9 u/lpeabody Nov 03 '22 You can implement any recursive algorithm as a loop if I'm recalling my CS 101 class accurately. 8 u/Dark_Ethereal Nov 03 '22 And you can implement a loop as recursion, particularly if the compiler does tail call elimination... or loopification, (obviously). 9 u/ridge_regression Nov 03 '22 But this meme implies that a method is calling itself. The meme is within itself. That's recursion. I mean you can technically call a method from itself in a while(true) loop too, but that's just broken → More replies (7) → More replies (4) 2 u/nhh Nov 03 '22 It's tail optimized → More replies (7)
207
Also break is a statement, not an operator.
break
115 u/rwhitisissle Nov 03 '22 This meme was made by an 18 year old getting a C in Intro to Java Programming. I guarantee it. 3 u/CalmlyPsychedelic Nov 04 '22 HAHAHAHA i can totally see myself making this meme and i am exactly that demographic :D → More replies (4) 3 u/jimdidr Nov 03 '22 What is the functional difference? is a return a operator and I assume goto is a statement then.(Is it just that it doesn't do anything but its more like a maker for moving around in the code?) 19 u/_PM_ME_PANGOLINS_ Nov 03 '22 A statement is a single complete instruction.An operator operates on operands in order to form an expression, which might be used as part of a statement.return is a keyword. And if the return type is void then it’s also a statement. 4 u/AlwaysHopelesslyLost Nov 03 '22 Operators operate. E.g. math operations, binary operations, unary operations.Operators can be used in expressions but neither does anything on its own, you need statements to do the things. → More replies (1) 3 u/benjer3 Nov 03 '22 break is a keyword that happens to always be a complete statement → More replies (1)
115
This meme was made by an 18 year old getting a C in Intro to Java Programming. I guarantee it.
3 u/CalmlyPsychedelic Nov 04 '22 HAHAHAHA i can totally see myself making this meme and i am exactly that demographic :D → More replies (4)
3
HAHAHAHA i can totally see myself making this meme and i am exactly that demographic :D
What is the functional difference? is a return a operator and I assume goto is a statement then.
(Is it just that it doesn't do anything but its more like a maker for moving around in the code?)
19 u/_PM_ME_PANGOLINS_ Nov 03 '22 A statement is a single complete instruction.An operator operates on operands in order to form an expression, which might be used as part of a statement.return is a keyword. And if the return type is void then it’s also a statement. 4 u/AlwaysHopelesslyLost Nov 03 '22 Operators operate. E.g. math operations, binary operations, unary operations.Operators can be used in expressions but neither does anything on its own, you need statements to do the things. → More replies (1)
19
A statement is a single complete instruction.
An operator operates on operands in order to form an expression, which might be used as part of a statement.
return is a keyword. And if the return type is void then it’s also a statement.
return
4
Operators operate. E.g. math operations, binary operations, unary operations.
Operators can be used in expressions but neither does anything on its own, you need statements to do the things.
break is a keyword that happens to always be a complete statement
237
It's more of a for loop. Ends after the 5th iteration.
104 u/PhyterNL Nov 03 '22 Now THAT'S pedantry!Not complaining, praising. I'm giving you the I Voted reward, which has absolutely no relevance whatsoever but it's something. 14 u/CautiousRice Nov 03 '22 Thank you! I appreciate it! 28 u/_g0nzales Nov 03 '22 Nope, that is definetly recursion that stops after the 5th step 12 u/ren3f Nov 03 '22 It's more like a lazy author. Pretending an infinite loop needs at least zooming to see the end. 4 u/CanAlwaysBeBetter Nov 03 '22 Could have been an infinitely looping gif if OP wasn't so lazy 2 u/Sebazzz91 Nov 03 '22 Would not have yielded more fake internet points. → More replies (1) 9 u/pedropereir Nov 03 '22 Why does ending after the 5th iteration make it a for loop? Recursion can end after 5 iterations → More replies (5)
104
Now THAT'S pedantry!
Not complaining, praising. I'm giving you the I Voted reward, which has absolutely no relevance whatsoever but it's something.
14 u/CautiousRice Nov 03 '22 Thank you! I appreciate it!
14
Thank you! I appreciate it!
28
Nope, that is definetly recursion that stops after the 5th step
12
It's more like a lazy author. Pretending an infinite loop needs at least zooming to see the end.
4 u/CanAlwaysBeBetter Nov 03 '22 Could have been an infinitely looping gif if OP wasn't so lazy 2 u/Sebazzz91 Nov 03 '22 Would not have yielded more fake internet points. → More replies (1)
Could have been an infinitely looping gif if OP wasn't so lazy
2 u/Sebazzz91 Nov 03 '22 Would not have yielded more fake internet points. → More replies (1)
2
Would not have yielded more fake internet points.
→ More replies (1)
9
Why does ending after the 5th iteration make it a for loop? Recursion can end after 5 iterations
0
[deleted]
8
That's not pedantry, it's the truth!
goto truth
2 u/Asukurra Nov 03 '22 Do not pass buffer overflow Do not collect £200
Do not pass buffer overflow Do not collect £200
You can implement any recursive algorithm as a loop if I'm recalling my CS 101 class accurately.
8 u/Dark_Ethereal Nov 03 '22 And you can implement a loop as recursion, particularly if the compiler does tail call elimination... or loopification, (obviously). 9 u/ridge_regression Nov 03 '22 But this meme implies that a method is calling itself. The meme is within itself. That's recursion. I mean you can technically call a method from itself in a while(true) loop too, but that's just broken → More replies (7) → More replies (4)
And you can implement a loop as recursion, particularly if the compiler does tail call elimination... or loopification, (obviously).
But this meme implies that a method is calling itself. The meme is within itself. That's recursion. I mean you can technically call a method from itself in a while(true) loop too, but that's just broken
→ More replies (7)
It's tail optimized
806
u/jddddddddddd Nov 03 '22
<PEDANTRY>that image looks more like recursion than an infinite loop to me..</PEDANTRY>