This might sound surprising but after close to 2 years working in the IoT field, I am yet to fully understand the ternary operator. Today I was forced by a project I am doing to read and understand it. So here is what I understood.
The ternary operator is some kind of conditional statement.
relayState ? Relay_ON : Relay_OFF
This means that if relay state returns true, turn on the relay, else turn it off.
a>b ? a : b
If a is greater than b, return a else return b.
Simple as that.