Simple Loop with function