View unanswered posts | View active topics It is currently Sun Jul 05, 2015 11:04 am






Reply to topic  [ 2 posts ] 
What does the exclamation point mean in code? 
Author Message
Rookie

Joined: Tue Mar 24, 2015 1:55 pm
Posts: 1
Post What does the exclamation point mean in code?
What does the exclamation point mean in the following code?

else if((!(SensorValue[leftlight] > lightSensorThreshold)

in other words how is the above code different from the code below

else if(((SensorValue[leftlight] > lightSensorThreshold)

thanx.


Tue Mar 24, 2015 2:01 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3542
Location: Rotterdam, The Netherlands
Post Re: What does the exclamation point mean in code?
Code:
if(!(SensorValue[leftlight] > lightSensorThreshold))

means if SensorValue[leftlight] is NOT greater than lightSensorThreshold, which is the same as
Code:
if(SensorValue[leftlight] <= lightSensorThreshold)

!, which is also pronounced as "bang" or "not" will invert the statement following it.
= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Tue Mar 24, 2015 3:52 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.