Safe Calls and the Not-Null Assertion
Learn to handle null values and implement exception-handling functions for safer code.
We'll cover the following...
We'll cover the following...
Safe calls
The simplest way to call a method or a property on a nullable value is with a safe call, which is a question mark and a dot (?.) instead of just a regular dot (.).
Safe calls work as follows:
If a value is
null, it does nothing and returnsnull. ...