2: Logic and flow control
Keyword | Definition |
---|---|
indentation | adding tabs or spaces to the start of a line to affect when it should be run |
nested | when an instruction is indented so that it runs within another section of code (e.g. if statement within another if statement) |
programming construct | programming building block e.g sequence, selection or iteration |
selection | programming construct used whenever a program has to make a decision (e.g. if statement) |
Keyword | Definition |
---|---|
!= | check if two values are not equal |
< | True if the value on the left is less than the value on the right |
<= | True if the value on the left is less than or equal to the value on the right |
== | True if two values are equal |
> | True if the value on the left is greater than the value on the right |
>= | True if the value on the left is greater than or equal to the value on the right |
comparative operator | symbol used to compare |
Keyword | Definition |
---|---|
and | logical operator which combines two boolean expressions and results in True if both inputs are True |
boolean expression | question which has an answer of either True or False |
logical operator | keyword which allows you to combine boolean expressions into a single boolean value |
not | logical operator which gets the opposite boolean value of a single input |
or | logical operator which combines two boolean expressions and results in True if either or both inputs are True |
xor | logical operator which combines to boolean expressions and results in True if only one of the inputs is True |