How to exit an NXC void

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

How to exit an NXC void

Post by mattallen37 »

How do you exit/stop/end a void in an NXC program?
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Re: How to exit an NXC void

Post by mightor »

try "return" with no value.

- Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: How to exit an NXC void

Post by afanofosc »

Maybe you are talking about an NXC function or subroutine or procedure that has no return value? For the sake of clarity I encourage you to refer to a function that returns no value as either a "function" or a "procedure" or a "subroutine" rather than a "void". The keyword void is just the type returned by a function that returns no value.

I recommend this wikipedia page: http://en.wikipedia.org/wiki/Void_type. It says:
A function with void result type ends either by reaching the end of the function or by executing a return statement with no returned value.
That's the standard C mechanism for exiting a function early (as Xander already mentioned). Happy B-day, Xander!!!

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests