Write a statement that toggles the value of onOffSwitch. That is, if onOffSwitch is false , its value is changed to true ; if onOffSwitch is true , its value is changed to false .
LANGUAGE: JAVA
CHALLENGE:
Write a statement that toggles the value of onOffSwitch. That is, if onOffSwitch is false , its value is changed to true ; if onOffSwitch is true , its value is changed to false.
SOLUTION:
LANGUAGE: JAVA
CHALLENGE:
Write a statement that toggles the value of onOffSwitch. That is, if onOffSwitch is false , its value is changed to true ; if onOffSwitch is true , its value is changed to false.
SOLUTION:
if (onOffSwitch == true) onOffSwitch = false; else onOffSwitch = true;