val name: Option[String] = request getParameter "name" name.fold("") { _.toUpperCase } On the spark-dev mailing list, there was a discussion on using Option.fold instead of Option.map/getOrElse combination. Two idioms look almost the same, but people seem to prefer one over the other for readability reasons. Here is the summary of the discussion: Option.getOrElse/map is a more idiomatic Scala code