How to Use Python Match Case Statements

preview_player
Показать описание
A 'match case' statement in Python allows you to check a variable or function value and perform different things based on the result!

It is a good replacement for applications that use a lot of repetitive if-else statements and is similar to match case syntax of other C-based programming languages!

Feel free to leave a comment with any questions or to say what you'd like to see on the channel next, and don't forget to leave a like on the video and subscribe to the channell!

Thanks for watching and goodluck with your code!
Рекомендации по теме
Комментарии
Автор

Looks to be a more advanced version of the "switch" statement from the C languages.
Wonder why it took them so long to add it in but I'm glad it's available - much more intuitive.

flioink
Автор

Very well done tutorial! Did you say, however, that this is only available in Python 3.10 or later? I just upgraded to Python 3.12, so wanting to make sure I can use it.

kylemuldrow
Автор

Can we use match case statement for matching a string in python, I am struggling with this in python ❤.

SUCCESS_GUY
Автор

Haha, the thing is, I was wondering how to do this and you made a tutorial on it. Now that is luck.🎮

willwillcode
Автор

how about something like this
switch (DrawingMode)
{
case Drawing.TurtleSnowflake:
drawable = new TurtleSnowflake();
break;
case Drawing.TurtleGosper:
drawable = new TurtleGosper();
break;

wburris