Flow-control structures: Difference between revisions

Content added Content deleted
(→‎Case 8 - continue: added "with" statement and "yield" expressions)
(→‎Case 8 - continue: else in "for" loop)
Line 443: Line 443:
</pre>
</pre>


====Case 8 - continue====
===Case 8 - continue, else in "for" loop===
<pre>
<pre>
i = 101
i = 101
Line 450: Line 450:
continue # continue goes back to the loop beginning for a new iteration.
continue # continue goes back to the loop beginning for a new iteration.
print "I'll never be seen."
print "I'll never be seen."
else:
print "Loop done"
print "Loop done"
# Output:
# Output:
Line 462: Line 463:
main()
main()
</pre>
</pre>

===The "with" statement===
===The "with" statement===
'''Interpreter:''' [[Python]] 2.6
'''Interpreter:''' [[Python]] 2.6