Java for Humans { Control Flow Statements: Decisions}

Lincoln W Daniel
ModernNerd Code
Published in
6 min readDec 19, 2015

--

View Table of Contents | Download Supporting Code | Subscribe to ModernNerd Youtube Channel for Coding Videos | By Lincoln W Daniel

Decisions, decisions, decisions … Decisions are the concepts you had no control over as a baby. As you grew older, however, the world expected you to start making decisions for yourself. In school, you had to make a decision everyday to sit in the front or in the back of the room; if you sat in the back, you ran the risk of being less attentive, and if you sat in the front, you had a better chance of getting the excellent grade. When it’s raining, you have to make a decision to use an umbrella or not; if you use the umbrella, you stay dry, and if you don’t use the umbrella you get wet and sad.

Why Decisions are Important & Useful

In Java, your code is generally executed from top to bottom in order. Line one will be executed before line two, line three after line two, and line four before line five but definitely after line three. This is great when you are writing simple programs, but when it’s time for your programs to do more, your code will have to employ control flow statements to allow your program to do some things sometimes and other things when the time is write. One form of control flow statements are decision-making statements which allow us to tell our program to do Task A if a condition is true or Task B if it is not true: If it is raining, use the umbrella, otherwise, leave it in the closet.

--

--

Lincoln W Daniel
ModernNerd Code

Chief Bull @ BullAcademy.org ® Elevating writers @ ManyStories.com. Author @JavaForHumans Ex: Editor in Chief MarkGrowth (acq.), Engineer @Medium @GoPuff