Line of the Day #001

Line number 5 was super fun to get to.

It does the following:

  1. Gets newValue from set and uses the nil coalescing operator to either:
    1. Return the unwrapped value if newValue is not nil, or
    2. Return an empty string: ""
  2. Then – using the ternary operator – it checks whether the returned value isEmpty (i.e., is an empty string) :
    1. If it is empty, it sets constant to 0.0
    2. Otherwise, it sets constant to 4.0

To get to that line we started with what you can see in the commented out code starting on line 9. Pretty fun stuff 🙂

 

 

Advertisements