[Remind-Fans] Repeat every six months

Tim Chase remind at tim.thechases.com
Fri Mar 4 15:13:48 EST 2022


On 2022-03-04 14:47, Michael DeBusk via Remind-fans wrote:
> > "Take the number of the month (Tm) , divide it by 6, and check
> > the remainder." The remainder is 3 during the months of March and
> > September.  
> 
> I got that much through my skull. The part that's sticking for me is
> dividing a smaller number by larger one and getting something
> greater than 1 left over. I think I'm not understanding exactly
> what the modulo operator does.

It's not so much division as the "remainder" operator.  If you divide
Dividend by Divisor, you'll get the quotient and some remainder.  That
remainder will be 0 ≤ remainder < Divisor

In this case, it divides by 6 (the periodicity you wanted, every 6
months).  The remainder will fall in the range 0 ≤ r < 6 so if
r=0 you have month 6 (Jun) or 12 (Dec); if you have r=1, that's 7
(Jul) or 1 (Jan), etc.  Thus it will be 3 in March/Sept.

For only 2 of them in the year, it's a toss-up as to which you find
easier to read, the modulo math I proposed or the disjunction ($Tm==3
|| $Tm==9) that Dianne proposed.  When you start to need more, like
quarterly events, that's where the modulo version starts to shine

  REM 1 --1 SATISFTY [$Tm % 3 == 1] MSG Jan/Apr/Jul/Oct event

vs

  REM 1 --1 \
    SATISFTY [$Tm == 1 || $Tm == 4 || $Tm == 7 || $Tm == 10] \
    MSG Jan/Apr/Jul/Oct event

Hopefully you find the explanation helpful and useful :-)

-tim






More information about the Remind-fans mailing list