trying to use the mod operator to display rtwo ite...
# cfml-general
g
trying to use the mod operator to display rtwo items on the row, but somehow its always displaying one item on row i have a cfloop over an array and at the bottom before my array ends, i am adding a code to
Copy code
<cfif ((e-1 % 2) + 1) mod 0>
          </div>
      </cfif>
a
Have you dissected the entire expression in your
<cfif>
there? Maybe output each parenthetical bit, to make sure each one is actually the value you expect
If I don't understand a compound expression, I do stuff like:
Copy code
writeDump({
    "e-1" = e-1,
    "e-1 % 2" = e-1 % 2,
    "(e-1 % 2) + 1)" = (e-1 % 2) + 1),
    " ((e-1 % 2) + 1) mod 0" =  ((e-1 % 2) + 1) mod 0
})
See how I'm dumping each bit? One bit might make me go "hang on, what?", and it's where I start troubleshooting from.
👍 3
👍🏼 1