created working loop

if loop