Is there a way to condense these four if statements into a for loop and with a single if condition? I was told that there is a way but I can only think of multiple else if s