Jekyll arithmetic in conditional expression
I am trying to do some basic arithmetic in a Jekyll engine for a fluid pattern. I have assigned one variable numColumns
and I am trying to use it in a conditional expression.
{% assign numColumns = 3 %}
Note. I missed the outer for loop in the following statement where it comes from loopindex
. Regardless, this works with the operator -
and correctly evaluates to the value 2.
{% if loopindex == 3 - 1 %}
However, these alternatives I've tried don't work:
{% if loopindex == numColumns - 1 %}
{% if loopindex == numColumns | minus: 1 %}
{% if loopindex == {{ numColumns }} - 1 %}
{% if loopindex == {{ numColumns | minus: 1 }} %}
How can I subtract one from numColumns
in a conditional expression using the fluid simulator?
+3
source to share