Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gatukgl/c05279c057d94d5f31abf457fa95e8fd to your computer and use it in GitHub Desktop.
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.
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