View Full Version : How to let the wrong program interrupt execution ?

03 March 2009, 12:18 AM
If has carried out a judgment type.

if (a = 10 ) then print "ok" else
(print "stop Function"
stop program

How Compiles " stop program" Content .
Requests master help to answer, thanks ~

03 March 2009, 11:07 AM
try 'throw' if you want to throw an error


for i = -100 to 100 do (
if (i == 0) then (
throw "zomg! you nearly divided by zero!"
print (1.0 / i)

If just want to exit a function early, use "return <something>", or exit a loop early using "exit [with <something>]"
( note that 'return' and 'exit' take additional computation time and letting a function/loop run its course is often, paradoxically, faster.

03 March 2009, 12:38 PM
Thanks for the advice, i appreciate it.

CGTalk Moderation
03 March 2009, 12:38 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.