Example 4: Displaying Definite Array Elements

The example below demonstrates how to display required array elements:

<!--{foreach $.arr as index => value}-->

   Index: <!--{= index.toString() }-->

   Is First: <!--{= index === 0 }-->

   Is Last: <!--{= index === $.arr.length-1 }-->

<!--{/foreach}-->

In the result you will get the current index value as string, the first and the last elements of the arr array correspondingly.