Python Forum
Is there a goto like there is in BASIC?
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is there a goto like there is in BASIC?
#22
(Apr-22-2017, 12:01 AM)Larz60+ Wrote: There are certain things that recursion does that I can't really imagine doing any other way.
Anything recursive can be written in an iterative fashion. You might have to manage a stack manually, but it's always doable.

While I believe "indirect" (or "mutual") recursion is playing with fire, and I regret deeply the one time I tried it, "direct" or regular recursion has a learning curve to it but is arguably better than using break or continue in a loop. CPython lacks optimizations for recursion, but as a style of control flow it can be an elegant way to avoid side effects.
Reply


Messages In This Thread
RE: Is there a goto like there is in BASIC? - by micseydel - Apr-22-2017, 08:57 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  goto jmabrito 34 10,589 Feb-18-2021, 09:55 PM
Last Post: jmabrito
  How to make input goto a different line mxl671 2 2,508 Feb-04-2020, 07:12 PM
Last Post: Marbelous
  goto problem Skaperen 1 2,777 Jan-27-2018, 01:11 PM
Last Post: stranac
  Go up script/menu(a goto command) foxtreat 7 8,318 Apr-24-2017, 05:58 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020