Reputation: 187
For example, if I want to accomplish this:
match value :
case 2 :
case 3 :
case 5 :
case 7 :
case 11 :
case 13 :
case 17 :
case 19 :
print('It is prime!')
case default :
print('It is not prime')
but by doing something like this:
match value :
case 2, 3, 5, 7, 11, 13, 17, 19 :
print('It is prime!')
case default :
print('It is not prime')
The references I've read don't seem to have this type of combination operation. Thoughts?
Upvotes: -1
Views: 409
Reputation: 187
Found it:
match value :
case 2 | 3 | 5 | 7 | 11 | 13 | 17 | 19 :
print('It is prime!')
case default :
print('It is not prime')
Upvotes: 0