![Free-eBooks.net](/resources/img/logo-nfe.png)
![All New Design](/resources/img/allnew.png)
while True:
s = raw_input('Enter something : ') if s == 'quit':
break
if len(s) < 3:
continue
print 'Input is of sufficient length' # Do other kinds of processing here...
$ python continue.py
Enter something : a
Enter something : 12
Enter something : abc
Input is of sufficient length Enter something : quit
In this program, we accept input from the user, but we process them only if they are at least 3 characters long. So, we use the built-inlen function to get the length and if the length is less than 3, we skip the rest of the statements in the block by using thecontinue statement. Otherwise, the rest of the statements in the loop are executed and we can do any kind of processing we want to do here.
Note that thecontinue statement works with thefor loop as well.