Packs needed
FreeLogic@rabbinatix/packs-needed by Rabbinatixupdated Oct 4, 2026
10 items in packs of 4: buy 3 packs, 2 spare.
Rounds the number of packs up and says how many items are left over.
Shows: Round Up, Divide, Multiply, Subtract.
How to use it
Add it to your logic, then add a Call Function step in any logic and pick Packs needed. It belongs to no system, so every system can use it. Or download the TypeScript and call it from your own code.
Inputs
items: Whole number
packSize: Whole number
Outputs
packs: Whole number
spare: Whole number
Previewdrag the steps around; scroll to zoom
Function Entry, Input / output. 0 inputs, 3 outputs. step 1 of 6
Packs needed
items
packSize
Divide, Operators. 2 inputs, 1 output. step 2 of 6
/
A
B
result
Round Up, Math. 1 input, 1 output. step 3 of 6
Round Up
value
result
Multiply, Operators. 2 inputs, 1 output. step 4 of 6
*
A
B
result
Subtract, Operators. 2 inputs, 1 output. step 5 of 6
-
A
B
result
Return, Input / output. 3 inputs, 0 outputs. step 6 of 6
Return
packs
spare
Arrow keys: next or previous step in flow order. Alt with arrows: nearest step in that direction. Enter: open. Shift F10: more actions.
Examplesrun live against the logic · 2/2 pass
| Passed | Example | Input | Output |
|---|---|---|---|
| Some spare | {"items":10,"packSize":4} | {"packs":3,"spare":2} | |
| Exact | {"items":8,"packSize":4} | {"packs":2,"spare":0} |
Try it
Versions
In this package
Packs needed (entry)
