logoalt Hacker News

antonvsyesterday at 6:08 AM1 replyview on HN

> scream for a case/switch-statement

Maybe I’m missing some context, but all that actually should be needed in the top-level else block is ‘gradient[idx]’. Pretty much anything else is going to be longer, harder to read, and less efficient.


Replies

e12eyesterday at 8:30 AM

True, with early return - there's no need to actually nest with else.

Logically this still would be a case/switch though...

show 1 reply