Intro To C++/Making '''''statement'''''
Controlling with if and else
editThe C++ if keyword performs the basic conditional test. If something is true, then perform action. And it's syntax looks like this:
if(test-expression){statements-to-perform-when-true}
We could want the different action if that relationship is false. By appending else statement, it is possible.if-else statement looks like this:
if(test-expression){statements-to-perform-when-true} else{statements-to-perform-when-true}
Controlling with switch
editWhen we have multiple case to check, using if-else statement repeatedly is not efficient.In this case, switch is more useful.