title: How to increment a variable in Gatlling Loop
body: <p>I am trying to write a Gatling script where I read a starting number from a CSV file and loop through, say 10 times. In each iteration, I want to increment the value of the parameter.</p>
  
  <p>It looks like some Scala or Java math is needed but could not find information on how to do it or how and where to combine Gatling EL with Scala or Java.</p>
  
  <p>Appreciate any help or direction.</p>
  
  <pre><code>var numloop = new java.util.concurrent.atomic.AtomicInteger(0)
  
  val scn = scenario("Scenario Name")
  
  .asLongAs(_=&gt; numloop.getAndIncrement() &lt;3, exitASAP = false){
      feed(csv("ids.csv"))   //read ${ID} from the file
      .exec(http("request")
          .get("""http://finance.yahoo.com/q?s=${ID}""")
          .headers(headers_1))
      .pause(284 milliseconds)
  
      //How to increment ID for the next iteration and pass in the .get method?
  }
  </code></pre>