By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,745 Members | 1,957 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,745 IT Pros & Developers. It's quick & easy.

toggles the value?

P: 5
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.
Sep 18 '06 #1
Share this Question
Share on Google+
1 Reply

P: 293
Expand|Select|Wrap|Line Numbers
  1. toggle = !toggle;
It's the logical NOT operator. NOT(true) = false, NOT(false) = true.
Sep 19 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.