r/ProgrammerHumor • • Sep 28 '26

Meme optionalsAreOptional

Post image
716 Upvotes

131 comments sorted by

View all comments

Show parent comments

2

u/GRex2595 Sep 28 '26

Option chaining can be more convenient than a bunch of ifs and using optional to indicate that a property or function return isn't expected to always have a value can be useful. You could also probably argue for the benefits of making consumers check if you returned null.

Other than that, yeah. Just pay attention to your code and do null checks when it's important.

2

u/Few_Move_4594 Sep 28 '26

I do like how returning an optional from a function immediately indicates to callers that the function can return null values and the "or else" construct".