loop based example