K
K
kickass772021-12-14 08:22:16
Python
kickass77, 2021-12-14 08:22:16

match python 3.9.1 invalid syntax error?

Python 3.9.1

What is the correct way to use match?

All examples on the Internet do not want to work correctly.
Gives all the time:

^
SyntaxError: invalid syntax


An example of another code from the Internet:

quit_flag = False
match quit_flag:
    case True:
        print("Quitting")
        exit()
    case False:
        print("System is on") 
}


How to decide? Google is silent.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-12-14
@kickass77

Ask Google in which version the match-case appeared, I think it will not be silent. It's 3.10

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question