How to do modulus calculation in maestro 7

I would like to calculate the modulus of two numbers.

If x=5 and y=2, I want to set z=1.
If x=6 and y=2, I want to set z=0.

In other words, I’m trying to see if variable ‘x’ is odd, or even.

So, I’ve tried “Set Variable ‘z’ to Calculation ‘CALCULATE(x%y)’” action

but no dice.

How can I do this? Thanks!

Btw, I’ve looked at this page:

https://wiki.keyboardmaestro.com/manual/Calculations

And I see the ‘MOD’ operator, but it’s not clear from the documentation how to use it inside the CALCULATE() function.

I figured it out: it’s simply “x MOD y”

So the action block for this would look like:

“Set Variable ‘z’ to Calculation ‘x MOD y’”

1 Like