Skip to main content

Section 14.1 Conditional Statements

Checkpoint 14.1.1. Computers and Decision Making.

How has computer-based decision making impacted your life?
Name a story where it helped (or hurt) you.
If you cannot think of anything, go through your daily routine. Computers make tons of decisios daily. How would your life be different if the computer(s) you use made different decisions? Hint: your phone is a computer!
Now we are going to combine everything we have learned about MATLAB to allow our programs to make decisions. The trick is to combine what we learned about the relational and logical operators and thinking algorithmically to create what are called conditional statements.
A conditional statement is an if-then statement (there are a few other flavors that we will learn about shortly, but this is the most simple one). We already saw examples of these types of statements in the thinking algorithmically chapter, but here are a few examples of conditional statements to jog your memory:
  • If I skip my brain workouts, then I will not understand the material.
  • If I finish my homework on time, then I will receive a high grade on homework.
  • If it is raining outside, then I will wear a jacket.
You have attempted of activities on this page.