title: flatMap function and return type error in Scala
body: <p>I'm new to Scala/Spark world. I'm trying to figure out why this code is acceptable:</p>
  
  <pre><code>val artistID = rawArtistData.flatMap { line =&gt;
    val (id, name) = line.span(_ != '\t')
    if (name.isEmpty) {
      None
    } else {
      try {
        Some(id.toInt, name.trim)
      } catch {
        case e: NumberFormatException =&gt; None
      }
    }
  }
  </code></pre>
  
  <p>And this is not:</p>
  
  <pre><code>val artistID = rawArtistData.flatMap { line =&gt;
    val (id, name) = line.span(_ != '\t')
    if (name.isEmpty) {
      None
    } else {
      try {
        (id.toInt, name.trim)
      } catch {
        case e: NumberFormatException =&gt; None
      }
    }
  }
  </code></pre>
  
  <p>I know it has to do with type mismatch, but that is about it. My question is why can't I return a tuple?</p>