xxxxxxxxxx
var match_this: int = 40
match match_this:
7:
print(" I matched with 7")
40:
print(" I matched with 40")
_:
print(" I didn't match with 7 or 40")
#if you set match_this to 7 it will print this:
# I matched with 7
#if you set match_this to 40 it will print this:
# I matched with 40
#if you set match_this to 47 it will print this:
# I didn't match with 7 or 40
xxxxxxxxxx
var my_variable = "Not Hello"
match my_variable:
"Hello":
print("Hi")
"Not Hello":
print("Not Hi")