[Tutor] Different between pass & continue
Christian Witts
cwitts at compuscan.co.za
Tue May 18 14:17:28 CEST 2010
M. Bashir Al-Noimi wrote:
> Hi All,
>
>
> I couldn't understand the difference between pass and continue
> keywords, could you explain to me?
>
>
Taken from the docs at http://docs.python.org/tutorial/controlflow.html
The continue statement continues the next iteration of a loop for eg.
for line in file:
if not line.strip(): # If the line is empty then
continue
The pass statement does nothing. It can be used when a statement is
required syntactically but the program requires no action. For example:
while True:
pass # Busy-wait for keyboard interrupt (Ctrl+C)
--
Kind Regards,
Christian Witts
More information about the Tutor
mailing list