C++ TutorialLesson 14Free preview
C++ If...Else
This lesson is part of C++ · All levels
Summary
This lesson discusses branching if, else if, and else to make the program make decisions based on specific conditions. If the condition is worth true then the if block is executed, if not then the else block is executed. This concept allows programs to be dynamic according to the data received.
Key points
- The main branches are written with if, else if, and else.
- The condition is placed in the box after the keyword if.
- = for assignment of values, whereas == for comparison.
- The else block is optional and executed when all conditions are previous.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.