View unanswered posts | View active topics It is currently Fri Apr 19, 2019 6:42 am

Reply to topic  [ 2 posts ] 
Return Codes 
Author Message

Joined: Tue Oct 04, 2011 6:22 am
Posts: 7
Post Return Codes
Hi all,

after my first steps with programming our NXT 2.0 Robot I still have beginner questions. I checked too in the help of the RobotC IDE but I cannot find it.

Is there a possibility to give return/exit codes and can I check on it with the robot?

My next question is if it is possible to include an error handling and are error codes available, so I can display them?

Thanks and regards


Sun Aug 12, 2012 9:08 am
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: Return Codes
Just like with C, you can declare a function to have a specific return type.
bool isItTrue(int checkthis)
  if (checkthis == 2)
    return true;  // return true
   return false;

You can specify many return types, including int, long, bool and float.
int  addUp(int num1, int num2)
  return num1 + num2;

For debugging purposes, have a look at the Sample Programs\NXT\NXT Feature Samples\Debug Stream.c program. I use this extensively.

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

Sun Aug 12, 2012 9:36 am
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:  

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