Respuesta :

You should state the language you're using in these types of questions; here's an example in C++.

bool onOff = true;
if (onOff)
onOff = false;
else
onOff = true;