Conditionals 2: 'switch'
Duration: 57:02
Created with
Ben Fhala
Ben Fhala is the creative force and founder behind 02geek, a pioneering platform dedicated to making web development accessible to everyone. With over 18 years of experience in the industry, Ben has a deep passion for teaching and a knack for breaking down complex concepts into easy-to-understand lessons.
Conditionals 2: 'switch' Overview
What you'll learn
We have seen various methods to write if conditional depending upon number of conditions which includes if, if..else, else..if, nested..if etc. Switch can be used to replace else..if conditional statement and is used when there are multiple options to make the code simple. In this video, we will learn how to write switch and understand its importance over if conditional in various circumstances. We will also look at keywords such as break and exit, and learn the concept of ternary operation.
Ready to Level Up Your Skills?
Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!
Enroll Now for Free!Overview
We'll look at the drawbacks and lack of flexibility of the if-else and else-if construct, and propose an alternative which is more flexible and powerful
Switch
We'll introduce you to the switch construct, explaining how it can be used to make decisions based on checking and comparisons using a single identifier
Breaking The switch Down
We'll discover and describe in detail the importance of using break statements in switch cases, and the pitfalls if we forget/choose not to do so. Let us learn about the break keyword in detial
Switch In Action: Days Of The Month
We will see a few code examples in as3 to illustrate certain programming logic which can be implemented very easily and concisely using switch constructs
What if Can't Do...
We'll see unique programming logic which is elegantly and efficiently achieved using switch constructs, but are next to impossible with if constructs
The Ternary Operation (:?)
Enhancing the readability of code and introducing efficiency for simple decision making scenarios using ternary operator ?: We will also learn the syntax for using ternary operator
The Ternarator
In this video, we will see how to use ternary operator for complex conditionals. We will compare it by if conditional and discuss the necessity for understanding the concept and its implementation in
Ready to Level Up Your Skills?
Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!
Enroll Now for Free!