Nova verzija Python-a podržava switch-case izjave

Nova verzija Python-a podržava switch-case izjave

https://rubikscode.net/2021/10/04/python-3-10-top-... link-img
avatar

Čitavu listu promena i feature-a možete naći ovde, a autor ovog teksta izdvojio je pet za koje smatra da će imati najviše uticaja. Među njima, nalazi se i Structural Pattern Matching koji će Python-u konačno omogućiti switch-case izjave. To znači da ako želite da proverite više vrednosti, sada postoji jednostavniji način.

Iz članka:

A new version of Python – Python 3.10.0 has been released. As usual with each Python release, there are several big topics and a couple of smaller features and in this article, we cover five which we think are going to make the biggest impact:

Structural Pattern Matching is definitely going to have the biggest impact. If you are familiar with a switch-case statement from any other language, this one is that, but on steroids. Python was not supporting switch-case statements, or similar concepts until now. There were several attempts to include this concept in the language, however, they were always rejected. The easiest way to use this new Python feature is to compare a variable with several values. There are two new keywords: match and case.

0

ULOGUJ SE I DODAJ KOMENTAR


Registruj ili prijavi.

VIDI POPULARNE POSTOVE


0
3
avatar Stefan pre 3 dana
3
6
avatar Igor pre 47 dana
1
0
avatar Stefan pre 2 dana
1
0
avatar Nikola pre 2 dana