Original post

Hi All,
I am passing a slice of data to a template. This slice can be any length from 1 – 6. Within the template I assign each slice to a variable via its index: {{$varName := index .sliceName 1}}.
I am trying to find a way to check if the index exists before assigning to the variable. I have tried {{ if index .sliceName 5 }} but get errors.
The end result I am aiming for is to only print a part of the template if an index of the slice exists.

Any help/pointers would be greatly appreciated.

Thanks in advance