.With for any of variables from list

Hello, everyone. Haven’t found by the search, but maybe someone knows. I need something like .With but for several conditions. So, if only one of them is true, .With will work. There are about 5-7 variables could be.
For example:

    {{ $name := (.name) }}
    {{ $address := (.address) }}
    {{ with $address or $name }}
      <li><i class="icon icon-location-sm"></i>{{ $address }}</li>
    {{ end }}

Thank you!

Try just using an if-statement.

{{ if or .name .address .foo .bar }}
3 Likes

Thank you, it works. You saved my time!