imperative / Java
Representation
Collected by Matthias Hauswirth — Compilers (control-flow graphs) and flow charts
Understand concept of short-circuit Boolean operators (|| and &&), and see how they only evaluate their right operand if needed.
PL | NM |
---|---|
... | ... |
|| in condition | 'false' arrow to extra diamond node |
&& in condition | 'true' arrow to extra diamond node |
The idea that for short-circuit Boolean operators, the second operand may never be evaluated (allowing common constructs like if (o!=null && o.length>0) ...
When introducing short-circuit operators && and ||
Requires prior introduction of 'Selection'.
This is the fourth in a sequence of "Control Flow as Graph" notional machines:
This notional machine is implemented by the Informa Clicker tool. This tool allows students in a classroom to construct control flow graphs in in-class clicker exercises.
Do you have feedback on this notional machine? Did you find a mistake, or do you have a request for improvement? You can create an Issue on GitHub, where the description is hosted. This way we can see your feedback and address it.
For this, you need a GitHub account. Then follow this link to see the source file of this page. In there, click the ... left of the highlighted line, then pick "Reference in a new issue".