C++ Switch Statement
Kenny Yip Coding Kenny Yip Coding
21.9K subscribers
292 views
0

 Published On Feb 20, 2024

C++ Switch Statement. In this video, you will learn how to use a switch statement for comparing values instead of using an if/else condition statement. With a switch statement, at compile time, a jump table/look up table is created, which maps each case value. With the table, C++ will jump to the case that matches the value. This is much more performant than an if/else statement, where we need to check each individual if statement until we hit our condition. This is known as the if/else ladder.

In addition, you will learn how to group switch cases together and use the break statement to exit the switch case code blocks.

C++ Playlist:
   • C++ Programming Tutorial  

Subscribe for more coding tutorials 😄!

show more

Share/Embed