compare three variable

Here is an alternative that that could easily be adjusted to handle different numbers of elements.

Edit: for something dynamic it would be something like this:

5 Likes