What does .public do?

In the documentation I see this code snippet to range over an array.

<ul>
  {{ $urlPre := "https://api.github.com" }}
  {{ $gistJ := getJSON $urlPre "/users/GITHUB_USERNAME/gists" }}
  {{ range first 5 $gistJ }}
    {{ if .public }}
      <li><a href="{{ .html_url }}" target="_blank">{{ .description }}</a></li>
    {{ end }}
  {{ end }}
</ul>

I can’t find any information anywhere on what .public does. It is the only time .public is ever used on the gohugo documentation. What is the if checking for in this piece code?

Also have a secondary question. In my code I iterate over an array an want to execute something at a certain index, but the way I’m trying to do it doesn’t seem to be working.

{{ range $index, $element := .Params.array }}
      {{ if eq $index 4 }}
             hello
      {{ end }}
{{ end }}

If the range hits index 4 it never seems to go into my if, am I doing this the wrong way or is this just not possible.

The GitHub gists have a field name public to mark, I assume, if the gist is public or private. If it is private, it doesn’t make sense to link to it.

Oh alright that makes sense!
I also just edited in a secondary question when you replied, do you perhaps know the answer to this one too? :smiley:

Your second issue looks correct – but remember that the indexes start at 0, the index 4 will be the 5th element.