Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

continue and break in python

while True:
    line = input('Write something: ')
    if not line == '':    # if the line variable is not empty, run the code block
        print(line)
        continue    # Continues back to the beginning of the while loop
    else:  
        break # if the line variable is empty come out the loop and run the next code
print('End of the program')
Source by docs.python.org #
 
PREVIOUS NEXT
Tagged: #continue #break #python
ADD COMMENT
Topic
Name
5+3 =