r/ProgrammerHumor • • 1d ago • Bravo 1

Meme baseCaseNotFound

Post image
2.6k Upvotes

43 comments sorted by

510

u/bozehaan 1d ago

This is not recursion, this is just an ugly GOTO

59

u/peeja 1d ago

6

u/Scared_Accident9138 1d ago

What something gets compiled to doesn't make the original solution ugly

5

u/Comprehensive_Day511 1d ago

Actually, it's ragebait. And we fell for it.

0

u/[deleted] 1d ago

[deleted] — view deleted comment

69

u/starfish0r 1d ago

OP is misunderstanding basic concepts

174

u/johnschnee 1d ago

You don’t know anything about programming, don’t you?

This is not how recursions work.

2

u/Single-Oil3168 17h ago

def read(t)

if t < 5:

update t

read(t)

print("I will be there in 5 minutes")

read(t)

-39

u/ProsodySpeaks 1d ago

I agree.

But you don't know much about English don't you? 

7

u/No-Finance7526 19h ago

do you*

1

u/ProsodySpeaks 17h ago

Yes that's correct. have you read the comment i replied to? 

1

u/johnschnee 17h ago

I am pretty sure that you are totally perfect in all foreign languages you speak….

-1

u/ProsodySpeaks 15h ago

So ok to dunk on op for using 'recursion' wrong but not on commenter for usung 'don't' wrong. Gotcha.

0

u/[deleted] 1d ago

[deleted] — view deleted comment

92

u/johnschnee 1d ago

no it is not. it’s something completely different.

24

u/kratz9 1d ago edited 1d ago
void waitForSteve()
{
   sleep(300);
   if(!isSteveHere())
       waitForSteve();
}

20

u/mothzilla 1d ago
while !isSteveHere() {
  wait(5);
}

13

u/urban_piktor2030 1d 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)

6

u/VictoryMotel 1d 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.

2

u/a_gomez-298 9h ago

The CI job is still waiting for Steve too.

0

u/[deleted] 1d ago

[deleted] — view deleted comment

46

u/fecal-butter 1d ago

Oh god its that time of the year again when college freshmen get to this point in the corriculum

3

u/Nestramutat- 1d ago

You know what, yeah, mid/late November is about when I learned recursion in my first programming class, spot on

2

u/Some_Noname_idk 1d ago

I'm in college and we just finished recursion, so that checks out

58

u/SaneLad 1d ago

That's just a conditional jump.

45

u/spaham 1d ago

That’s a goto not a recursion

-25

u/purplepharoh 1d ago

It's a recursive goto if execution doesnt return

33

u/bennyboy_ 1d 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...

0

u/WoodenWhaleNectarine 9h ago

Recursion is doing stuff again until you arrive (at the solution)

18

u/Automatic-Way1887 1d ago

Looks more like a while with no exit clause

13

u/owjfaigs222 1d ago

That's more of a loop or even a goto statement

8

u/davejohncole 1d ago edited 1d ago

That is iteration.

At best you could call it tail recursion, but that just collapses to iteration.

15

u/SAKDOSS 1d ago

You may have to learn recursion again in the future.

4

u/Inevitable-Course-63 1d ago

do {   wait(5 minutes); } while (im not there):

2

u/idimetrix 1d ago

The base case is them actually showing up, so yeah this one never returns.

1

u/Dillenger69 1d ago

You should always have some kind of recursion limiter when you have actual recursion.

1

u/CarousalAnimal 1d ago

That’s just a grab and bag

1

u/Symphonic_nerve 1d ago

Guilty 😅

1

u/ProgramBrave718 18h ago

Thanks i have also learnt recursion

1

u/gerbosan 1d ago

How loops until overflow?

1

u/Individual_Win_3417 1d ago

An hour later: StackOverflowError

-4

u/boxofbuscuits 1d ago

Wow, I too have learnt recursion just now

12

u/Maximelene 1d ago

OP hasn't learned it yet.

-1

u/NearLawiet 1d ago

Im pretty sure nerds will be saying this is not recursion 🤣
Some will also try to explain with code snippets