Converting repetitive if statements into a loop

join shbcf.ru