Want to create interactive content? It’s easy in Genially!
Get started free
Conditionals Structures
Nixon López
Created on March 2, 2022
Start designing with a free template
Discover more than 1500 professional designs like these:
View
Visual Presentation
View
Terrazzo Presentation
View
Colorful Presentation
View
Modular Structure Presentation
View
Chromatic Presentation
View
City Presentation
View
News Presentation
Transcript
CONDITIONALS STRUCTURES
Week 3 - Programming Class
01
What are the conditionals structures?
Conditional structures are used for decision making in algorithms: If something happens then we execute some statements and otherwise we execute others.
Simple and Compound Conditional Structures
IF
Expresses "if". If the condition is met (true), it will execute a block of code.
ELSE
Expresses "otherwise". It is executed when the if conditional is not fulfilled.
Selective Structures Conditionals
Switch & Case
It allows us to organize blocks of code, so that they are executed when a certain condition or case is met.
Ver
Practice section
Prompt the user for 2 numbers and show whether the first number is greater than or equal to the second (or vice versa), or both are equal), or otherwise, both are equal.
Ask the user for age and gender, so that the computer will tell you if you can already retire. Note that a man can retire when he is 60 years old or older, while an older woman will retire if she is over 54 years old.
A student needs to calculate the value of the area of a geometric figure. The geometric figures available are the triangle, circle, rectangle and a hexagon.
¡Muchas gracias!