r/ProgrammerHumor • • 7h ago

Meme baseCaseNotFound

Post image
1.2k Upvotes

30 comments sorted by

243

u/bozehaan 7h ago

This is not recursion, this is just an ugly GOTO

-101

u/ItsPuspendu 6h ago

Bro is debugging a joke

24

u/starfish0r 2h ago

OP is misunderstanding basic concepts

80

u/johnschnee 6h ago

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 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.

-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

41

u/SaneLad 7h ago

That's just a conditional jump.

28

u/spaham 7h ago

That’s a goto not a recursion

-1

u/purplepharoh 5h ago

It's a recursive goto if execution doesnt return

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

8

u/Maximelene 4h ago

OP hasn't learned it yet.

1

u/gerbosan 7h ago

How loops until overflow?