Lecture 7 While loop

Run Settings
LanguagePython
Language Version
Run Command
x=5 while x > 0: print(f"Top of loop, x is: {x}") # Check if x is 4 if x == 4: x = x - 1 print("Continuing... skipping the rest of this block!") continue # Jumps back to 'while x > 0' # Check if x is 3 if x == 3: print("Breaking... exiting the loop entirely!") break # Jumps out of the loop to the end of the script # This only runs if 'continue' or 'break' weren't triggered x = x - 1 #this line is the Engine, making the loop a decrement else: # This will NOT print because the loop was 'broken' print("out of while")
Editor Settings
Theme
Key bindings
Full width
Lines