Create loop and if