11: Two Way Selection
( \newcommand{\kernel}{\mathrm{null}\,}\)
- 11.1: If Then Else
- We are going to introduce the control structure from the selection category that is available in every high level language. It is called the if then else structure. Asking a question that has a true or false answer controls the if then else structure.
- 11.2: Boolean Data Type
- The Boolean data type is also known as the logical data type and represents the concepts of true and false. The name "Boolean" comes from the mathematician George Boole; who in 1854 published: An Investigation of the Laws of Thought.
- 11.3: Relational Operators
- The relational operators are often used to create a test expression that controls program flow. This type of expression is also known as a Boolean expression because they create a Boolean answer or value when evaluated. There are six common relational operators that give a Boolean value by comparing (showing the relationship) between two operands.
- 11.4: Compound Statement
- For illustration we will use the syntax for the if then else control structure within the C++ programming language. However this problem generally exists for all control structures within any language that requires the use of compound statements.