Python continue statement


  Translation results:

Python continue statement jumps out of this loop, while break jumps out of the entire loop.

The continue statement is used to tell Python to skip the remaining statements of the current loop and continue with the next cycle.

The continue statement is used in while and for loops.

Python continue statementsyntax

Python continue statement jumps out of this loop, while break jumps out of the entire loop.

The continue statement is used to tell Python to skip the remaining statements of the current loop and continue with the next cycle.

The continue statement is used in while and for loops.

Python continue statementexample

#!/usr/bin/python# -*- coding: UTF-8 -*-
for letter in 'Python': # first instance
if letter == 'h': continue
print 'Current letter:', letter
var = 10               # The second instance while var  > 0:                  
var = var -1
if var == 5: continue
print 'Current variable value:', varprint "Good bye!"

Popular Recommendations

Home

Videos

Q&A