C-style loop implemented