2 - Practical Problem Solving & Programming / Selection
|
|
Selection
An effective computer program is one that can adapt or react to information that it is given. The ability for a program to decide what action to take based on a certain condition opens up huge potential for the usefulness of algorithms.
Selection
In programming, the term selection means that the program can choose to run different commands based on a condition being true or false. For example if a user enters their age into a drivers license system and their age is less than 17, the program will tell them that they are too young. If the users age is 17 or older then the user can be prompted with further instructions to apply for a license.
There are two ways to achieve selection these are IF statements and Select Case statements
There are two ways to achieve selection these are IF statements and Select Case statements
IF Statement
|
Case Statement
|
Vertical Divider