Match expressions result in a value, which is the reason why digit variable can be assigned to the match expression. Another difference from Java is that there are no breaks at the end of each alternative. Instead the break is implicit, and there is no fall through from one alternative to the next, which is why only one result will be returned (in our case it's 1)
Source: Match expressions
Войдите чтобы поставить Нравится
Войдите чтобы прокомментировать