Dealing with Optionals

In Chapter 6, Map, Filter, and Reduce we talked about map and flatMap functions, and we said that optionals are Monads. In this chapter, we will look at optionals. We need to deal with optionals as some of the functions/methods that we need to call or provide may return some values or none. This chapter explores the concept of optionals and provides different techniques to deal with them.

This chapter will cover the following topics with coding examples:

  • Optional types
  • Unwrapping optionals
  • Optional binding
  • Guard
  • Coalescing
  • Optional chaining
  • Optional mapping
  • Dealing with optionals functionally
  • Using fmap and apply for multiple functional mapping
  • Error handling
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset