Control flow Flashcards
while statement
Used for repeated execution as long as an expression is true
if statement
Used for conditional execution
for statement
Used to iterate over the elements of a sequence.
try statement
Specifies exception handlers and/or cleanup code for a group of statements.
with statement
Used to wrap the execution of a block with methods defined by a context manager.
match statement
Used for pattern matching.
break statement
Breaks out of the innermost enclosing for or while loop.
range()
Iterates over a sequence of numbers
continue statement
Returns the control to the beginning of the while or for loop.
else clause
catches anything which isn’t caught by the preceding conditions
elif clause
If the previous conditions were not true, then try this condition.
pass statement
Does nothing. It can be used when a statement is required syntactically but the program requires no action.
match statement
Takes an expression and compares its value to successive patterns given as one or more case blocks.
functions
A block of code that only runs when it is called.