{% if (model.Friends.size == nil or model.Friends.size <= 0) and (model.PendingFriends == nil or model.PendingFriends.size <= 0) %}
<div>
<h2 class="text-muted">#No Friends</h2>
<p class="text-muted">You have no friends on this platform yet. Don't worry, I'm sure you'll make some!</p>
</div>
{% endif %}
And this was ALWAYS showing the result, because PendingFriends was always an empty array, even though Friends wasn't empty.
Checking for either case individually worked as expected, but putting together a couple of grouped ORs with an AND via parenthesis did not work as expected.
PHP: 8.x
Liquid: 1.4.42
OS: Linux -> LAMP stack
If I'm just missing something, let me know, but removing the nil checks makes it work as expected (just less safe).
I had the following if statement:
And this was ALWAYS showing the result, because PendingFriends was always an empty array, even though Friends wasn't empty.
Checking for either case individually worked as expected, but putting together a couple of grouped ORs with an AND via parenthesis did not work as expected.
PHP: 8.x Liquid: 1.4.42 OS: Linux -> LAMP stack
If I'm just missing something, let me know, but removing the
nil
checks makes it work as expected (just less safe).