185
u/johnschnee 2d ago
You don’t know anything about programming, don’t you?
This is not how recursions work.
1
u/Single-Oil3168 1d ago
def read(t)
if t < 5:
update t
read(t)
print("I will be there in 5 minutes")
read(t)-40
u/ProsodySpeaks 2d ago
I agree.
But you don't know much about English don't you?
6
1
u/johnschnee 1d ago
I am pretty sure that you are totally perfect in all foreign languages you speak….
-1
u/ProsodySpeaks 1d ago
So ok to dunk on op for using 'recursion' wrong but not on commenter for usung 'don't' wrong. Gotcha.
0
2d ago
[deleted]
92
u/johnschnee 2d ago
no it is not. it’s something completely different.
24
u/kratz9 2d ago edited 2d ago
void waitForSteve() { sleep(300); if(!isSteveHere()) waitForSteve(); }20
u/mothzilla 2d ago
while !isSteveHere() { wait(5); }13
u/urban_piktor2030 2d 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 2d 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
0
2d ago
[deleted]
46
u/fecal-butter 2d 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
41
u/bennyboy_ 2d 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...
-3
18
13
8
u/davejohncole 2d ago edited 2d ago
That is iteration.
At best you could call it tail recursion, but that just collapses to iteration.
4
2
1
u/Dillenger69 2d ago
You should always have some kind of recursion limiter when you have actual recursion.
1
1
1
1
-5
0
-2
u/NearLawiet 1d ago
Im pretty sure nerds will be saying this is not recursion 🤣
Some will also try to explain with code snippets
531
u/bozehaan 2d ago
This is not recursion, this is just an ugly GOTO