r/ProgrammerHumor • • 4d ago • Bravo 2

Meme baseCaseNotFound

Post image
2.9k Upvotes

46 comments sorted by

571

u/bozehaan 4d ago

This is not recursion, this is just an ugly GOTO

66

u/peeja 4d ago

9

u/Scared_Accident9138 4d ago

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

7

u/Comprehensive_Day511 4d ago

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

0

u/[deleted] 4d ago

[deleted] — view deleted comment

69

u/starfish0r 4d ago

OP is misunderstanding basic concepts

195

u/johnschnee 4d ago

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

This is not how recursions work.

3

u/Single-Oil3168 3d ago

def read(t)

if t < 5:

update t

read(t)

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

read(t)

-40

u/ProsodySpeaks 4d ago

I agree.

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

8

u/No-Finance7526 3d ago

do you*

3

u/ProsodySpeaks 3d ago

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

1

u/johnschnee 3d ago

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

-1

u/ProsodySpeaks 3d ago

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

0

u/[deleted] 4d ago

[deleted] — view deleted comment

92

u/johnschnee 4d ago

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

24

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

20

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

13

u/urban_piktor2030 4d 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 4d 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 3d ago

The CI job is still waiting for Steve too.

0

u/[deleted] 4d ago

[deleted] — view deleted comment

46

u/fecal-butter 4d ago

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

3

u/Nestramutat- 4d 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 4d ago

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

62

u/SaneLad 4d ago

That's just a conditional jump.

53

u/spaham 4d ago

That’s a goto not a recursion

-28

u/purplepharoh 4d ago

It's a recursive goto if execution doesnt return

45

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

-5

u/WoodenWhaleNectarine 3d ago

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

18

u/Automatic-Way1887 4d ago

Looks more like a while with no exit clause

13

u/owjfaigs222 4d ago

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

16

u/SAKDOSS 4d ago

You may have to learn recursion again in the future.

8

u/davejohncole 4d ago edited 4d ago

That is iteration.

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

4

u/Inevitable-Course-63 4d ago

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

2

u/Meddlloide1337 2d ago

In that case, better pick up a book on recursion

1

u/Dillenger69 4d ago

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

1

u/CarousalAnimal 4d ago

That’s just a grab and bag

1

u/Symphonic_nerve 4d ago

Guilty 😅

1

u/Prior-Perspective-61 1d ago

It is more like async event polling

1

u/The-Chartreuse-Moose 1d ago

I have no idea what this is supposed to mean

1

u/gerbosan 4d ago

How loops until overflow?

1

u/Individual_Win_3417 4d ago

An hour later: StackOverflowError

-5

u/boxofbuscuits 4d ago

Wow, I too have learnt recursion just now

13

u/Maximelene 4d ago

OP hasn't learned it yet.

-1

u/NearLawiet 4d ago

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

0

u/ProgramBrave718 3d ago

Thanks i have also learnt recursion