Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

match statement

def http_error(status):
    match status:
        case 400:
            return "Bad request"
        case 404:
            return "Not found"
        case 418:
            return "I'm a teapot"
        case _:
            return "Something's wrong with the internet"
Source by docs.python.org #
 
PREVIOUS NEXT
Tagged: #match #statement
ADD COMMENT
Topic
Name
8+3 =