Flow Control
Flow control refers to the logic you use in a program to make decisions. One of the functions of a program is to contain logic to make decisions, and these statements provide a logical way of expressing that logic. Expressions in flow control are contained within blocks, delimited by curly braces (“{“, ”}”). Although there are certain conditions in which the braces are optional (e.g., a one-line check), I have always found it best to include them for readability, if not your own, then for the next person who sits down with your code.
if..else
This is a simple construct for checking conditions within a block of code. With this syntax, you check for explicit conditions to be met. Using this construct, every condition will be evaluated. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access