Recursive function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Recursive function

Anyone can tell me how's recursive function work i am not getting it i just know it is the method of recursion or repeating function itself...

31st Jul 2020, 2:09 PM
Husnain Qureshi
Husnain Qureshi - avatar
1 Answer
+ 1
recursion functions work like this: imagine there is a line of people and you want to find someone called "Dave". You can ask the name from every single person in the queue, but you can also give arders to everyone that: if someone asks your name say your name. if your name is dave, stop. if not, then ask from the person behind you. if his name is Dave shout. this way you ask from the first person (call the function) and then everyone asks from the person behind (recursive fubction) untill they find dave.
31st Jul 2020, 2:33 PM
M. M. H.
M. M. H. - avatar