I am working on a project in making a timer socket using Arduino and a current sensor. For the code I decided to modify a code that was meant to be a kitchen timer.
In that code I found a statement
currentMode = currentMode == MODE_IDLE ? MODE_RUNNING : MODE_IDLE;
I assumed this works in a way that it chose whether the timer is in the current mode or the idle mode but I don’t understand the mechanism behind it. What does this statement mean?