Action RPG Inventory System

can you explain why i should never loop? i don’t understand why i should never loop.

also if i dont loop, how am i going to get all of the items in the container/inventory?
even if i make it myself, i would do a loop and then add it all to the inventory…

if possible, can you show an example or an alternative to the code?