468,513 Members | 941 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,513 developers. It's quick & easy.

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.
Sep 18 '06 #1
1 5864
D_C
293 100+
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.

Similar topics

3 posts views Thread by otto | last post: by
3 posts views Thread by Eric Chang | last post: by
13 posts views Thread by Stumped and Confused | last post: by
1 post views Thread by Dan | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.