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

I think switch blocks are only worth it when you have 2 or more `else if`, otherwise a normal `if` is more readable IMHO.


Normally I'd agree, but I really like the concise but readable way this handles the casting for you.


It might be if they used the One True Brace style ;)




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: