Lesson 7 of 50
cControl Flow – if / else
6 mins
Course progress14%
What you'll learn
Keep these ideas in mind as you work through the lesson.
Lesson 7 of 50
c6 mins
Keep these ideas in mind as you work through the lesson.
if statements execute a block when a condition is true. An optional else clause runs when the condition is false.
if (x > 0) {
printf("positive
");
} else {
printf("non‑positive
");
}