In reply to Ammu4392:
I’d use foreach for an array, but you can use both.
foreach (obj[i]) begin … end