In the last tutorial, you learnt about C++: Variables and Getting Input. In this tutorial, you'll learn about if-statements, using which you can do certain things only if certain conditions are met. In plain English, if-statements correspond to “Do this; then do that.” or “If this condition is true, perform this action; otherwise, do that action.”
A good way to visualize if-statements is flow charts. If-statements represent the yes / no questions in the flowchart below.
Before getting into if-statements, you'll first learn how to compare things in C++ using comparing operators and Boolean data type (values true and false) in much depth, which we learnt in previous tutorials. At the end of the lesson, you'll also see comments, which are useful for making your code more readable and easy to follow.