title: Do async GET like in a loop but wait for response for each
body: <p>I've googled this and cannot find an answer.</p>
  
  <p>I want to make a GET to a url in Scala/play framework and then do something with the result. If the result contains what I want then I want to call it again with some other parameter. And this could be up to like 100 times so I can't nest several WS's. I want like a loop to do the same call over and over again till I find what I'm looking for but when I wrap all this code below in a loop it dosen't wait for each call to finish, which i understand. But how can I solve this? </p>
  
  <pre><code>var index = 0
  
  val call = WS.url("http://urlToGetSomethingFrom&amp;parameter="+index).get()
  
  for{
  
  response &lt;- call
  
  } yield{
  
    val something: String = response.json / "name"
  
    if(something.equals("Eric")){
  
      //I'm finished, break out
  
    }else{
  
      index += 1
  
      //and then I want to do the same call again
    }
  
  }
  </code></pre>