0

Does python 3 have switch statement ?

I have been learning python 3, till now i have not seen switch statement in python. The other languages have switch statement, like JavaScript etc.

27th Aug 2019, 5:25 PM
Piush K Sangma
Piush K Sangma - avatar
2 ответов
+ 1
You can use the dictionary functions to go the 'elegant' and more readable way, but if/else are okay,too. :) Look here; https://jaxenter.com/implement-switch-case-statement-JUMP_LINK__&&__python__&&__JUMP_LINK-138315.html
27th Aug 2019, 6:06 PM
Tom Hammerbacher
Tom Hammerbacher - avatar
+ 1
No, Python doesn't have the switch statement. You have to use multiple if/elif/else statements.
27th Aug 2019, 5:58 PM
Diego
Diego - avatar