title: Is my .asLongAs condition wrong?
body: <p>Expected output should be 3 calls of
  like, </p>
  
  <ol>
  <li><a href="https://someurl.net;limit=5;offset=0" rel="nofollow noreferrer">https://someurl.net;limit=5;offset=0</a>  (1st call will start from 0 offset everytime - Must)</li>
  <li><a href="https://someurl.net;limit=5;offset=5" rel="nofollow noreferrer">https://someurl.net;limit=5;offset=5</a> (2nd call, limit + offsetvalue 0 + 5 = 5)</li>
  <li><a href="https://someurl.net;limit=5;offset=10" rel="nofollow noreferrer">https://someurl.net;limit=5;offset=10</a> (3rd call, limit + offsetvalue 5 + 5 = 10)</li>
  </ol>
  
  <p>Here is the code,</p>
  
  <pre><code>import java.util.concurrent.ThreadLocalRandom
  import scala.concurrent.duration._
  import io.gatling.core.Predef._
  import io.gatling.http.Predef._
  
  class metadataAn extends Simulation {
      val getAssetURL = System.getProperty("getAssetURL", "https://someurl")
      val username = System.getProperty("username", "user")
      val password = System.getProperty("password", "user")
  
      val limit = Integer.getInteger("limit", 5).toInt
      val counter = 0
  
      val httpProtocol = http
          .basicAuth(username, password)
          .baseURL(getAssetURL)
  
      // Step-1 get total count
      val scn = scenario("Get Total assets")
              .exec(http("Number of Assets")
              .get(s"""/api/xyz;limit=1;offset=0""")
              .check(jsonPath("$.totalCount").findAll.saveAs("total"))
              )
  
      //.asLongAs(session =&gt; counter.getAndIncrement().equals("${total}/$limit")) // Throws error mentioned below
      .asLongAs(session =&gt; session.get("${counter}").equals("10"))
      {
          exec(http("List of Assets")
              .get(session =&gt;s"""/api/xyz;limit=$limit;offset=${counter}""")
              .check(jsonPath("$.assets[*].id").findAll.saveAs("IdList"))
              )
  
          .foreach("${IdList}", "idlist") {
              exec(http("Add data")
                  .post("""/api/xyz/${idlist}/data""")
                  .body(StringBody(session =&gt;s"""{some data....}"""))
                  )
              }
          .exec(session =&gt; {
                  val cnt = session("counter").as[String].toInt
                  val increaseCounter = cnt + limit
                  session.set("counter", increaseCounter)
                  println("********COUNTER************: ====&gt;&gt;&gt; " + increaseCounter)
                  session})
  
      }
      setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)
  }       
  </code></pre>
  
  <p><strong>OUTPUT:</strong></p>
  
  <p>It compiles but not able to enter into the loop. </p>
  
  <pre><code>---- Get Total assets ----------------------------------------------------------
  [##########################################################################]100%
            waiting: 0      / active: 0      / done:1
  ---- Requests ------------------------------------------------------------------
  &gt; Global                                                   (OK=1      KO=0     )
  &gt; Number of Assets                                         (OK=1      KO=0     )
  ================================================================================
  </code></pre>
  
  <p>==============================</p>
  
  <p><strong>If I compile this with below condition</strong></p>
  
  <pre><code>.asLongAs(session =&gt; counter.getAndIncrement().equals("${total}/$limit"))
  </code></pre>
  
  <p>Throws Errors:</p>
  
  <pre><code>17:34:10.300 [ERROR] i.g.c.ZincCompiler$ - scala:34: value getAndIncrement is not a member of Int
  17:34:10.301 [ERROR] i.g.c.ZincCompiler$ -      .asLongAs(session =&gt; counter.getAndIncrement().equals("${total}/$limit"))
  17:34:10.486 [ERROR] i.g.c.ZincCompiler$ - one error found
  17:34:10.487 [DEBUG] i.g.c.ZincCompiler$ - Compilation failed (CompilerInterface)
  </code></pre>
  
  <p>Thank you.</p>