Use foreach instead of for because the foreach is less error prone.