[fix] use for, while and foreach loops