Saw some weird Ruby syntax in a PR that sent me Googling: &.

Turns out it was the Safe navigation operator.

What problem does it solve?

In Object Oriented code, where nasty null values may exist, this type of check is common:

if user && user.orders && user.orders.last ...

The reason for this nasty code is that any of these values could be null which would cause a runtime error.

The point of Safe navigation operator is to be able to walk this minefield in a little bit prettier way, and still not have your problem explode if it hits a null.

if user&.orders&.last ...

Makes it a little easier to read.

For me this brings to mind the power of pattern matching and the Option type in Scala, which wraps possible null values. That way just makes more sense to me.