2 Replies - 442 Views - Last Post: 10 November 2012 - 08:45 AM Rate Topic: -----

#1 ricardo49  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 02-November 12

Is there an equivalent of 'GOTO' in Python?

Posted 10 November 2012 - 08:31 AM

As I progress through my tutorial so far, I've encountered 'while' loops, 'if' loops and 'for' loops. Forgive me for continuing to compare Python to BASIC, but is there a Python counterpart for the 'GOTO' command? The Python programs I've written so far didn't seem to require line numbers. How do you get the program execution to loop somewhere, say, back to near the beginning or somewhere outside of those other kinds of loops?

Is This A Good Question/Topic? 0
  • +

Replies To: Is there an equivalent of 'GOTO' in Python?

#2 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5932
  • View blog
  • Posts: 12,855
  • Joined: 16-October 07

Re: Is there an equivalent of 'GOTO' in Python?

Posted 10 November 2012 - 08:42 AM

Thankfully, no. None at all.
Was This Post Helpful? 0
  • +
  • -

#3 darek9576  Icon User is offline

  • D.I.C Lover

Reputation: 198
  • View blog
  • Posts: 1,693
  • Joined: 13-March 10

Re: Is there an equivalent of 'GOTO' in Python?

Posted 10 November 2012 - 08:45 AM

First, they are not if-loops, just if-statements.
Use method calls for what you need to accomplish.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1