Searching for: Blocks in Python
Try Catch Block
A try-catch block is used to mitigate errors in code and prevent program crashing during runtime. It 'tries' a block of code that could give an error. If the error (exception) is raised, it will execute a different block of code rather than crash the program.
A function is a block of code that can be called from another location in the program or class.
The if else block controls decision making by checking true/false statements resulting in different executions of code, depending on if the result is true and if the result is false. There are three parts to the if-else block: if, elif, and else.
The while loop executes a block of code while a boolean expression evaluates to true. It terminates as soon as the expression evaluates to false. The boolean expression is evaluated before each iteration.
Next Page >