The ?. operator is the "safe call" operator. It replaces the standard dot-notation for calling a function or referencing a property. If the function or property reference is made on a real object, it works as normal. If the function or property reference is made on null, though, the safe call itself returns null.

dec() is a function on Int that returns the Int minus 1. Calling dec() on null directly results in a compile error, but using ?.dec() on null returns null.

You can learn more about this in:
Run Expand Edit