toggles the value?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • snhamilton
    New Member
    • Sep 2006
    • 5

    toggles the value?

    How do I do this? This is a basic computer programming question, so it should be very easy.


    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.
  • D_C
    Contributor
    • Jun 2006
    • 293

    #2
    Code:
    toggle = !toggle;
    It's the logical NOT operator. NOT(true) = false, NOT(false) = true.

    Comment

    Working...