View unanswered posts | View active topics It is currently Tue Sep 02, 2014 7:50 pm






Reply to topic  [ 3 posts ] 
'and' operator in ROBOTC 
Author Message
Rookie

Joined: Sat Jan 12, 2013 7:26 am
Posts: 12
Post 'and' operator in ROBOTC
Is there an 'and' operator for RobotC? Or do we have to nest if's to get an and condition?
Cheers.


Sat Jan 19, 2013 12:22 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3211
Location: Rotterdam, The Netherlands
Post Re: 'and' operator in ROBOTC
Yes there is. It's &&, and you can use it like this:
Code:
if (condition1 && condition2)
{
    // do something
}

Similarly, "or" is ||

As a sidenote, it is advisable to create topics that have slightly more descriptive subjects than "and". I almost deleted it thinking it was yet another spam message. I changed the topic for you, but keep this in mind.

= 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]


Sat Jan 19, 2013 12:29 pm
Profile WWW
Rookie

Joined: Sat Jan 12, 2013 7:26 am
Posts: 12
Post Re: 'and' operator in ROBOTC
My apologies for the confusion, and many thanks.


Sat Jan 19, 2013 12:53 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 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:  



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