mod ( n1 n2 -- n3 )
published: 29 January 2023 / updated 29 January 2023
Divide n1 by n2, giving the single-cell remainder n3.
Example:
21 7 mod . \ display 0 22 7 mod . \ display 1 23 7 mod . \ display 2 24 7 mod . \ display 3 \ The modulo function can be used to determine the \ divisibility of one number by another: : div? ( n1 n2 ---) over over mod cr if swap . ." is not " else swap . ." is " then ." divisible by " . ;