title: IteratorVariables tags: ListWidget Variables created: 20150106180000000 modified: 20150106180000000 The ListWidget exposes the following iterator variables during list processing: ; `<>` : set to the current index, e.g. `1` ; `<>` : set to `true` for an even index, otherwise `false` ; `<>` : set to `true` for last index, otherwise `false` The ListWidget allows to declare an `iterator` attribute through which you can declare a custom iterator variable prefix: ``` <$list filter="[tag[foo]]" iterator="my-foo"> ... ``` !!Using Iterator Variables You can use iterator variables with the RevealWidget to conditionally render output depending on the current index... ''only show for item at index 1, i.e. the first item'' ``` <$reveal type=match default=1 text=<>> ... ``` ''show for all except first index'' ``` <$reveal type=nomatch default=1 text=<>> ... ``` ''only show at even indexes'' ``` <$reveal type=match default=true text=<>> ... ``` ''only show at uneven indexes'' ``` <$reveal type=nomatch default=true text=<>> ... ``` ''only show for last index'' ``` <$reveal type=match default=true text=<>> ... ``` !! Live Example ```
<$list filter="one two three" iterator=foo>
<>
`<>` = <>
`<>` = <>
`<>` = <>
``` Displays as: <<<
<$list filter="one two three" iterator=foo>
<>
`<>` = <>
`<>` = <>
`<>` = <>
<<<