[[+content_image]]
D
D
denism3002021-03-18 14:40:49
MODX
denism300, 2021-03-18 14:40:49

How to implement parity check in If snippet?

I'm trying to make a different output depending on whether idx is even or not.
In the chunk I use the If snippet

[[!If?
    &subject=`[[+idx]] % 2`
    &operator=`EQ`
    &operand=`0`
    &then=`Это чётное`
    &else=`Это не чётное`
]]

However, regardless of idx, odd is output.

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
R
roswell, 2021-03-18
@denism300

Это чётное

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question