Ok so I am currently setting up a grid, each row will have 4 objects. The number of rows must be calculated according to this constraint.
So if I had 15 objects, I need 4 rows.
If i had 12 objects I need 3 rows.
Somehow I need some sort of mathematical formula that will perform and return this number. So when I say to the function I have x number of objects, it will return the number of rows.
Thanks for any help.
Warning: readability swamp
where obj is the number of objects in your question.
or even more concise:
One liner!
Floor usually comes with the language’s integer division operator (e.g, Java, C++), so it’s probably shorter to implement.