If else condition inside check in gatling

Hi ,

I need to implement a if else condition in my gatling check. For example in below i might get items array in json response as empty. So i need to check if items is empty i need to execute another set of action. Can you please let me know how I can achieve this.

.check(
jsonPath("$…items[(@.length-1)].id").saveAs(“MyAlbumId”)
)

When using a check, the default verify step is exists, so you have to use “whatever” instead if having your check find nothing is acceptable:
https://github.com/excilys/gatling/wiki/Checks#wiki-verifying

Then, you can use a doIf in order to perform a chain of actions on certain conditions:
https://github.com/excilys/gatling/wiki/Structure-Elements#wiki-do-if

For example:
doId(session => !session.isAttributeDefined(“MyAlbumId”)) {

}