Puting multiple if conditionals into loop

You could use a translate filter. This has an example that might help.