title: How to use the switch case in Scala to satisfy the condition?
body: <p>I have this code where I got stuck in the switch case syntax and future:</p>
  
  <pre><code>def getAll(implicit queryParams: QueryParams): Action[AnyContent] =
    securityService.authenticate() { implicit request =&gt;
      withErrorRecovery { req =&gt;
        toJson {
          repository.getAll(request.user.loginName).flatMap {
            xyz =&gt;
              Future.sequence(xyz.map {
                abc =&gt;
                  if (abc.roleName != " ") { // getting error 
                    case Some(abc) =&gt; repotosecondquery.getrepo()
                  }
  
                case None =&gt;
                  Future.failed(new
                      RuntimeException(NotFoundException()))
              })
          }
        }
      }
    }
  </code></pre>