Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's a switch statement that's an expression. That's a nice ergonomic improvement when you want to assign the result to a variable. Especially as it allows you to use a non-mutable variable whereas otherwise you'd have to make it mutable.


I wouldn't compare it to a switch statement, because a switch statement - even though it looks similar - has fundamentally different control flow.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: