use if instead of for