From the very beginning of computer languages, conditional branching of the program flow has been one of the most basic things program code must be able to express. This branching happens inside functions, so it imposes some kind of substructuring inside classes and singleton objects. In this chapter we cover such branching constructs, together with auxiliary classes that help us write corresponding code.
Ifs and Whens
In real life many actions are based on decisions. If some condition is met, an action A happens; otherwise, action B happens. For any programming language we need ...