Conditional Statements
In this section we are going learn how to use Conditional statements.
The three different kinds that we have are:
if / else statements
a ? b : c
case / switch
With these three different statements we gain a ton of functionality in programming. These statements allow us to test data. Being able to do this is the basis for coding and building programs.
The three different kinds that we have are:
if / else statements
a ? b : c
case / switch
With these three different statements we gain a ton of functionality in programming. These statements allow us to test data. Being able to do this is the basis for coding and building programs.
Videos
Conditional Statements explanation
Getting everything ready for the Conditional Statements
Conditional Statements in Code
Assignment
Use the Psuedocode below to build a program
// Ask you user for someone's age
// Test that number to make sure that it is not too small or two large
// The number should not be a negative or below zero
// The number should not be to big or larger than 125
// If the number entered is to small or too large that print out to the screen message telling them so
// Once the number has been tested to make sure that it is not big or small test it to see what group the person falls into
// ages 0-1 is a Baby
// ages 2-4 is a Toddler
// ages 5-19 is a Kid
// ages 11-12 is a Tween
// ages 13-19 is a Teenager
// ages 20-30 is an Adult
// ages 31-45 is a Middle Ager
// ages 46-55 is Over the Hill
// ages 56-65 is a Silver Fox
// ages 66-85 is an Old Fart
// ages 86-125 are Ancient
// Once the age number has been tested output to the User the correct name for the category that they fit into
// Ask you user for someone's age
// Test that number to make sure that it is not too small or two large
// The number should not be a negative or below zero
// The number should not be to big or larger than 125
// If the number entered is to small or too large that print out to the screen message telling them so
// Once the number has been tested to make sure that it is not big or small test it to see what group the person falls into
// ages 0-1 is a Baby
// ages 2-4 is a Toddler
// ages 5-19 is a Kid
// ages 11-12 is a Tween
// ages 13-19 is a Teenager
// ages 20-30 is an Adult
// ages 31-45 is a Middle Ager
// ages 46-55 is Over the Hill
// ages 56-65 is a Silver Fox
// ages 66-85 is an Old Fart
// ages 86-125 are Ancient
// Once the age number has been tested output to the User the correct name for the category that they fit into