Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python break

for i in range(5): # For loop
  if i == 3:
    break # Exits out of the for loop, even when not finished
  else:
    print(i)
    
number = 1
while number <= 5:
  if number == 4:
    break # Exits while loop
  else:
    print(number)
Source by www.codegrepper.com #
 
PREVIOUS NEXT
Tagged: #Python #break
ADD COMMENT
Topic
Name
1+7 =