Hey guys, I’m new to programming and I really hit the wall here. I know what modulo or modulus is but my comprehension falls short in this case. BTW this is exactly taken from the puzzle game template. I want to figure out how loops work and how can I iterate an objects n times but don’t understand what that modulo node does here. I know it is a simple and stupid question but I really want to learn this stuff.

Good example case for modulo is splitting items in a row. Lets say we have 20 items that needs to be placed in rows of 6 items. X modulo 6 = Y in loop (X =0-19, Y=remainder) would output numbers between 0 and 5 which we can use to populate each row

modulo returns the remaining number of a division. for example: 20 % 8 = 4.

step1: 20 / 8 = 2

step2: 2 * 8 = 16

step3: 20 - 16 = 4

the algorithm is basically: A - (B * Floor(A / B)). Floor() rounds down a number. so instead of 20 / 8 = 2.5, it rounds it down to 2.0. hope its clear now.