A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://realpython.com/courses/emulating-switch-case-python/discussion/ below:

Why Having a Switch/Case in Python Would Be Useful (Video) – Real Python

In this lesson, you’ll see why having switch/case in Python would be useful. Python does not have a switch/case statement and because of this, many Python developers useif statements to decide on what action to take based on a condition:

Python
if cond == 'cond_a':
    handle_a()
elif cond == 'cond_b':
    handle_b()
else:
    handle_default
Copied!

This lesson will go over some of the problems of using this approach.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4