Back to Browse

C++ Switch Statement

2.1K views
Feb 20, 2024
9:48

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: https://www.youtube.com/playlist?list=PLnKe36F30Y4ZDNIOZ51sX25pWKQ1pkpTE Github Repo for C++ Code: https://github.com/ImKennyYip/cpp Install C++ with VS Code: https://youtu.be/DMWD7wfhgNY Subscribe for more coding tutorials πŸ˜„! ⭐ If you enjoyed the tutorial and would like to support the channel, you can do so here πŸ’–: https://buymeacoffee.com/kennyyipcoding

Download

1 formats

Video Formats

360pmp413.8 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

C++ Switch Statement | NatokHD