DEV Community

Discussion on: What language features/concepts do insiders of the language love and outsiders hate?

Collapse
 
evanoman profile image
Evan Oman

I'm assuming they are similar to Option in Scala and Optional in Java? If so, they are amazing.

Collapse
 
twof profile image
Alex Reilly

Yup! Exactly that, but they're supported at the language level and every variable is, by default, not optional.

So if I write var foo: Int = 0, I can be sure that foo will never be nil, because if I write code that even places foo at risk of being nil, my program won't compile! Pretty awesome stuff.