Search code examples
scalafuturefor-comprehension

Scala: Ignore Future return value, but chain them


How should I write code, when I do not care about the returned value.

Example:

for {
    a <- getA // I do not care about a, but I need to wait for the future to finish
    b <- getB
} yield (b)

Solution

  • Like this

    for {
         _ <- getA 
         b <- getB
    } yield (b)