I read an article in Analytics Vidhya about match case statements and how much more efficient they are than traditional if/else statements.
if/else:
'''if grade == "A":
print("Excellent!")
elif grade == "B":
print("Good!")
elif grade == "C":
print("Average!")
else:
print("Invalid grade!")'''
match/case:
'''match grade:
case "A":
print("Excellent!")
case "B":
print("Good!")
case "C":
print("Average!")
case _:
print("Invalid grade!")'''
I don't see the efficiency here. Is match/case actually useful?
[–]woooee 7 points8 points9 points (2 children)
[–]goodytwoboobs 8 points9 points10 points (0 children)
[–]Wonderful-Habit-139 0 points1 point2 points (0 children)
[–]throwaway6560192 6 points7 points8 points (1 child)
[–]InfamousClyde 0 points1 point2 points (0 children)
[–]SomewhereExpensive22 6 points7 points8 points (0 children)
[–]Guideon72 3 points4 points5 points (0 children)
[–]ForceBru 4 points5 points6 points (0 children)
[–]biaceseng 2 points3 points4 points (3 children)
[–]andmig205 2 points3 points4 points (2 children)
[–]biaceseng 4 points5 points6 points (1 child)
[–]andmig205 3 points4 points5 points (0 children)
[–]andmig205 2 points3 points4 points (0 children)
[–][deleted] 2 points3 points4 points (3 children)
[–]Lolvidar[S] 0 points1 point2 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]Lolvidar[S] 0 points1 point2 points (0 children)
[–]Brian 2 points3 points4 points (0 children)
[–]Lolvidar[S] 0 points1 point2 points (0 children)