Created
May 9, 2021 13:54
-
-
Save gatukgl/c05279c057d94d5f31abf457fa95e8fd to your computer and use it in GitHub Desktop.
This code intend to be an example of Python code that has Pattern Matching.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def interact(action): | |
match action.split(): | |
case ["walking", direction]: | |
goTo(direction) | |
case ["pickup", item]: | |
save(item) | |
case ["quit"]: | |
quitGame() | |
case _: | |
print("😵 Don't know this command") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment