Return to Snippet

Revision: 21868
at December 22, 2009 15:32 by magicrebirth


Initial Code
>>>word = "Pithon Phrasebook"
>>>string = ""
>>>for ch in word:
>>>    if ch == 'i':
>>>        string +='y'
>>>        continue
>>>    if ch == ' ':
>>>        break
>>>    string += ch
>>>print string
Python

Initial URL

                                

Initial Description
The Python language provides break to stop execution and break out of the current loop. Python also includes continue to stop execution of the current iteration and start the next iteration of the current loop. The following example shows the use of the break and continue statements:

Initial Title
Python: iteration, break and continue

Initial Tags

                                

Initial Language
Python