title: For comprehension with two generators
body: <p>I want to display an arbitrary number of strings in a GUI-application in a vertical list.</p>
  
  <p>Consider the following example:</p>
  
  <pre><code>val names = Seq[String]("Boris", "Anna", "Markus", "Simone")
  
  for(a &lt;- 1 to names.size + 1; name &lt;- names) yield new ListItem(
    name,
    x = 20
    y = 128 * a
    size = 128
  )
  </code></pre>
  
  <p>Now of course this would create a "cross-product" and print:</p>
  
  <pre><code>Boris Anna Markus Simone
  Boris Anna Markus Simone
  Boris Anna Markus Simone
  Boris Anna Markus Simone
  </code></pre>
  
  <p>while the wanted result would be</p>
  
  <pre><code>Boris
  Anna
  Markus
  Simone
  </code></pre>
  
  <p>But how else can I bind the index to the actual variable? I mean if I'd do a counter like:</p>
  
  <pre><code>for(a &lt;- 0 to 1; b &lt;- 0 to 1)
  yield(a,b)
  </code></pre>
  
  <p>I'd get </p>
  
  <pre><code>Vector((0,0), (0,1), (1,0), (1,1))
  </code></pre>
  
  <p>but if I'd want to I could to <code>(for a &lt;- 0 to 1; b &lt;- 0 to a) yield(a,b)</code> and get </p>
  
  <pre><code>Vector((0,0), (1,0), (1,1))
  </code></pre>
  
  <p>I have no idea how to do that with my example tho.</p>