![]() |
|
[Python] Recursive Functions Alternatives? - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Python] Recursive Functions Alternatives? (/showthread.php?tid=5916224) |
Recursive Functions Alternatives? - TerribleTy27 - Dec 6, 2018 Code def examplefunction1(n)Recently started learning Python, and I'm having a bit of confusion over so called recursive functions. Basically, if I had a recursive function, would it send the return back to its original caller? If not, what can I do to replace that? Uhh, is anyone there? Anyone? RE: Recursive Functions Alternatives? - vorticalbox - Dec 7, 2018 PHP Code Your code wouldn't actually work and I added a print statement so you can it rolling numbers output example PHP Code when the number is more than 2 is returns the function call again and again until it is less than two in which case all the returns trigger and you get your result. Your other options are to use loops. PHP Code |