DEV Community


Discussion on: Language Features: Best and Worst

larrycinnabar profile image
Larry Cinnabar • Edited

1) A native not operator that can be prepended to any bool expression.

if not contains() { ... }

Simple ! is so unmarkable and not noticable when reading. But using false == ...() is ugly

2) defer like in golang. And option to defer a loop, not only a function. So action to be executed right after break (not just return)

3) a crazy idea but I'm always thinking about having a break-from-if operator. When you have compex if-logic, this option allows to make it easy, more flattened and therefore more readable

awwsmm profile image
Andrew (he/him) Author

Literally today I tried to break from an if in Java and got a compiler error. It would be a super useful addition.

Forem Open with the Forem app