[cmd] Mod (modulo)

stable
By Strooth in Miscellaneous Published December 2021 👁 1,234 views 💬 0 comments

Description

Gets the remainder of a division which is useful for checking if a number is a increment of 10 for example.
HaasScript
-- Author: Strooth
DefineCommand('mod', 'modulo - get the remainder of a division operand')
local a = DefineParameter(NumberType, 'dividend', 'The number you are performing the operand on', true, 100, 'input,numbertype')
local b = DefineParameter(NumberType, 'divisor', 'The number you are applying to the dividend in the division operand', true, 100, 'input,numbertype')
local out = a - (Floor(a/b)*b)
DefineOutput(NumberType, out, 'The remainder result', 'NumberType')

0 Comments

Sign in to leave a comment.

No comments yet. Be the first!