---
# System prepended metadata

title: Untitled

---


Implement a minimal `Option` that has `map` and `flatMap`.


```scala
import scala.{Option => _}
// implement here

sealed trait Option[A] {
    def map[B](f: A => B): Option[B] = {
        this match {
            case Some(a) => Some(f(a))
            case None    => None
        }
    }
    
    
    def flatMap[B](f: A => Option[B]): Option[B] = {
        this match {
            case Some(a) => f(a)
            case None    => None
        }
    }
}

case class Some[A](get: A) extends Option[A]
case class None extends Option[A]


Some(3).map(_+2)
Some(3).flatMap((x)=> Some(x+7))
```