class as loop