MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1y69oaj/basecasenotfound/
r/ProgrammerHumor • u/ItsPuspendu • 7h ago
30 comments sorted by
243
This is not recursion, this is just an ugly GOTO
21 u/peeja 4h ago Potato, potato. -101 u/ItsPuspendu 6h ago Bro is debugging a joke 24 u/starfish0r 2h ago OP is misunderstanding basic concepts
21
Potato, potato.
-101
Bro is debugging a joke
24 u/starfish0r 2h ago OP is misunderstanding basic concepts
24
OP is misunderstanding basic concepts
80
You don’t know anything about programming, don’t you?
This is not how recursions work.
-2 u/ProsodySpeaks 1h ago I agree.But you don't know much about English don't you? -97 u/ItsPuspendu 6h ago It's an analogy for recursion, not a textbook definition. Relax 💀 56 u/johnschnee 6h ago no it is not. it’s something completely different. 10 u/kratz9 5h ago edited 5h ago void waitForSteve() { sleep(300); if(!isSteveHere()) waitForSteve(); } 11 u/mothzilla 5h ago while !isSteveHere() { wait(5); } 6 u/urban_piktor2030 3h ago I mean, most of the simple recursions could be flattened into a loop. And if anything, it would be more likedo { wait (300); } while (!isSteveHere) 1 u/VictoryMotel 2h ago Recursion flattens to a loop if it isn't using the call stack as a stack data structure. If it does, it can be a loop with a typical stack inside. -5 u/ItsPuspendu 6h ago Fair point. Looks like I need to debug my understanding of recursion 23 u/fecal-butter 4h ago Oh god its that time of the year again when college freshmen get to this point in the corriculum
-2
I agree.
But you don't know much about English don't you?
-97
It's an analogy for recursion, not a textbook definition. Relax 💀
56 u/johnschnee 6h ago no it is not. it’s something completely different. 10 u/kratz9 5h ago edited 5h ago void waitForSteve() { sleep(300); if(!isSteveHere()) waitForSteve(); } 11 u/mothzilla 5h ago while !isSteveHere() { wait(5); } 6 u/urban_piktor2030 3h ago I mean, most of the simple recursions could be flattened into a loop. And if anything, it would be more likedo { wait (300); } while (!isSteveHere) 1 u/VictoryMotel 2h ago Recursion flattens to a loop if it isn't using the call stack as a stack data structure. If it does, it can be a loop with a typical stack inside. -5 u/ItsPuspendu 6h ago Fair point. Looks like I need to debug my understanding of recursion 23 u/fecal-butter 4h ago Oh god its that time of the year again when college freshmen get to this point in the corriculum
56
no it is not. it’s something completely different.
10 u/kratz9 5h ago edited 5h ago void waitForSteve() { sleep(300); if(!isSteveHere()) waitForSteve(); } 11 u/mothzilla 5h ago while !isSteveHere() { wait(5); } 6 u/urban_piktor2030 3h ago I mean, most of the simple recursions could be flattened into a loop. And if anything, it would be more likedo { wait (300); } while (!isSteveHere) 1 u/VictoryMotel 2h ago Recursion flattens to a loop if it isn't using the call stack as a stack data structure. If it does, it can be a loop with a typical stack inside. -5 u/ItsPuspendu 6h ago Fair point. Looks like I need to debug my understanding of recursion 23 u/fecal-butter 4h ago Oh god its that time of the year again when college freshmen get to this point in the corriculum
10
void waitForSteve() { sleep(300); if(!isSteveHere()) waitForSteve(); }
11 u/mothzilla 5h ago while !isSteveHere() { wait(5); } 6 u/urban_piktor2030 3h ago I mean, most of the simple recursions could be flattened into a loop. And if anything, it would be more likedo { wait (300); } while (!isSteveHere) 1 u/VictoryMotel 2h ago Recursion flattens to a loop if it isn't using the call stack as a stack data structure. If it does, it can be a loop with a typical stack inside.
11
while !isSteveHere() { wait(5); }
6 u/urban_piktor2030 3h ago I mean, most of the simple recursions could be flattened into a loop. And if anything, it would be more likedo { wait (300); } while (!isSteveHere) 1 u/VictoryMotel 2h ago Recursion flattens to a loop if it isn't using the call stack as a stack data structure. If it does, it can be a loop with a typical stack inside.
6
I mean, most of the simple recursions could be flattened into a loop. And if anything, it would be more like
do { wait (300); } while (!isSteveHere)
1 u/VictoryMotel 2h ago Recursion flattens to a loop if it isn't using the call stack as a stack data structure. If it does, it can be a loop with a typical stack inside.
1
Recursion flattens to a loop if it isn't using the call stack as a stack data structure. If it does, it can be a loop with a typical stack inside.
-5
Fair point. Looks like I need to debug my understanding of recursion
23 u/fecal-butter 4h ago Oh god its that time of the year again when college freshmen get to this point in the corriculum
23
Oh god its that time of the year again when college freshmen get to this point in the corriculum
41
That's just a conditional jump.
28
That’s a goto not a recursion
-1 u/purplepharoh 5h ago It's a recursive goto if execution doesnt return
-1
It's a recursive goto if execution doesnt return
13
Looks more like a while with no exit clause
9
That's more of a loop or even a goto statement
Why is this still getting upvoted? OP is painfully wrong about what recursion is. It doesn't mean just loop and do something over and over again... Goes to show how many people in this sub actually understand anything...
You may have to learn recursion again in the future.
2
The base case is them actually showing up, so yeah this one never returns.
An hour later: StackOverflowError
do { wait(5 minutes); } while (im not there):
You should always have some kind of recursion limiter when you have actual recursion.
That is iteration.
At best you could call it tail recursion, but that just collapses to iteration.
and the stack overflow happens when they finally text "actually just leaving now" 40 minutes later.
Wow, I too have learnt recursion just now
8 u/Maximelene 4h ago OP hasn't learned it yet.
8
OP hasn't learned it yet.
How loops until overflow?
243
u/bozehaan 7h ago
This is not recursion, this is just an ugly GOTO
80
u/johnschnee 6h ago
You don’t know anything about programming, don’t you?
This is not how recursions work.
41
u/SaneLad 7h ago
That's just a conditional jump.
28
u/spaham 7h ago
That’s a goto not a recursion
13
u/Automatic-Way1887 7h ago
Looks more like a while with no exit clause
9
u/owjfaigs222 5h ago
That's more of a loop or even a goto statement
9
u/bennyboy_ 1h ago
Why is this still getting upvoted? OP is painfully wrong about what recursion is. It doesn't mean just loop and do something over and over again... Goes to show how many people in this sub actually understand anything...
11
u/SAKDOSS 7h ago
You may have to learn recursion again in the future.
2
u/idimetrix 7h ago
The base case is them actually showing up, so yeah this one never returns.
2
u/Individual_Win_3417 6h ago
An hour later: StackOverflowError
1
u/Inevitable-Course-63 6h ago
do { wait(5 minutes); } while (im not there):
1
u/Dillenger69 6h ago
You should always have some kind of recursion limiter when you have actual recursion.
1
u/davejohncole 4h ago edited 4h ago
That is iteration.
At best you could call it tail recursion, but that just collapses to iteration.
1
u/General_Party4062 50m ago
and the stack overflow happens when they finally text "actually just leaving now" 40 minutes later.
1
u/boxofbuscuits 7h ago
Wow, I too have learnt recursion just now
1
u/gerbosan 7h ago
How loops until overflow?