Expression Language Syntax

"${foo(n)}" // returns the n-th element of `foo` if `n` points to an Int and `foo` to an indexed collection

That is provided by the gatling build in function.

But how something like this is achievable???

"${foo(n+1)}"

Getting error -- No attribute named 'n+1' is defined .
So how is this done, could someone show me with some example??

You have to compute a new attribute containing the sum and store it in the session.

Something like this , i am sending request in loop ( 3 times). Each request can only pass 5 Id’s . (Starting id from 1 to 15)
How i tried to achieve this is .

.exec(session => {
session
.set(“n”, 0)
})

.repeat(3, “counter”) {

exec(http(“validate ids”)
.get("/foo/validateId")
.queryParam(“Id”, “${id(n+1)}&${id(n+2)}&${id(n+3)}&${id(n+4)}&${id(n+5)}”)
.headers(headers_1))

exec(session => {

session
.set(“n”,"${n}" +5 )

})

}

But that is obviously not possible
Getting error – No attribute named ‘n+1’ is defined .

if i need to create a new attribute ( i will need to create 15 attributes - sometimes more depending on id’s )
could you please share some knowledge on this.