I see what you did here. Technically, not using curly braces for if and else statements is fine. The syntax problems can arise when you have multiple if/else if and else statements, like in your code below.
The curly braces act like containers for code waiting to execute depending on whether or not conditions are or aren't met.
The curly braces act like containers for code waiting to execute when conditions are or aren't met. When your braces don't correspond to the code within them, you'll get syntax error messages.
You should try removing all braces from the if/else if and else statements and see what error messages you get. Or if you get them at all.
I would still use curly braces for your compare function.