I am trying to understand how to repeat loops using the mod operator.
If you have two strings, "abc" and "defgh", how can % be used to loop through abc, repeating it until the end of defgh is reached? Namely, what is the mod relationship of the length of abc and defgh?
I don’t really understand this concept.
Simple.
Think about what the Modulus operator is doing, it discretely divides the left hand side by the right hand side, and spits back the integer remainder.
Example:
In our case, the left hand side represents the i’th position in “defgh”, the right hand represents the length of “abc”, and the result the looping index inside “abc”.