How to get data for the next and previous index in the for loop in hubl for setting conditions?

Thanks for clarifying many things in your code related to indexes and setting conditions under the loop; this is something I was looking for. @MBERARD