Optionis the way in Scala to handlenull.
It allows to encapsulate the concept of “is this value defined” or “does this variable contains a value“.
You might have guessed it on your own but theisDefinedmethod will returntruewhen theOptioncontains a value, andisEmptyreturnstruewhen theOptioncontains nothing.
We are going to learn, in later SKB, aboutpattern matchingandmap. It will allow us to modify the value contained in theOption.