loop and if