Scott Watermasysk Husband, Father, Bootstrapper, Developer, Keyboarder, Pained Sixers Fan.

Ruby Lonely Operator

Published:

Ruby 2.3 introduced a feature called the "Lonely Operator" (which I somehow missed until recently).

Instead of:

user && user.address && user.address.street

You can write it like this:

user&.address&.street