View Single Post
  #4   Spotlight this post!  
Unread 02-04-2015, 05:39 PM
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 7,998
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Limit Swtich Help

Quote:
A single "=" is an assignment operation and won't do what you want it to do.
True. (Hey, a little Boolean humor there).

Quote:
Originally Posted by Jon Stratis View Post
You need to use "==" inside of an if statement to get a Boolean.
You don't need "==" to return a Boolean: a single "=" inside an if() statement will indeed return a Boolean. But as you said above, not what the OP was expecting.

If you already have an appropriately-named Boolean variable, you can cleanly code it by simply testing the variable:

if (limitPressed) {...}


Reply With Quote