Command and Control
Overview
In this chapter, we’ll use branching logic and loops to demonstrate how logic can be controlled and selectively run. With these tools, you’ll have control of what you do and don’t want to run based on the values of variables.
By the end of this chapter, you will be able to implement branching logic using if
, else
, and else if
; use switch
statements to simplify complex branching logic; create looping logic using a for
loop; loop over complex data collections using range
; use continue
and break
to take control of the flow of loops; and use goto
statements to jump to a labeled statement within a function.