Raspberry if else statement
If the expression is true, code block 1 will be executed. If the expression is not true, code block 2 will be executed instead. For example, to take an umbrella if it's raining, and not take an umbrella otherwise.
This statement is used to judge a variety of conditions. Python will judge whether an expression is true one by one from top to bottom. Once an expression is true, the following code block will be executed. At this point, the remaining conditions will no longer be evaluated and thus not executed, regardless of whether they would have been true. If none of the expressions is true, the code block following “else” will be executed.