Aquablue Posted June 10, 2014 Share Posted June 10, 2014 Hello all, I just registered at the forum after lurking about for several weeks. My question concerns calling Exit within a function to return a value (True in this case, the function is supposed to return a boolean). When I try to compile the script it fails, and the debug window reports 'Internal error (20)'. This happens regardless of at which line the code is placed. For the moment I used Result := True; followed by Exit; which also works, but calling Exit(True) seems much more elegant to me. Is there any fix for this error? Quote Link to comment Share on other sites More sharing options...
LordJashin Posted June 10, 2014 Share Posted June 10, 2014 As far as I know. You can't pass a value to Exit;. It's not used for results or returns. Exit; is a Flow Control statement, used to exit the function that's currently executing. Break, Continue, Exit are all flow control statements. They usually don't have anything to do with that. If anything you might be able to put a number after them e.g. Break 3; to indicate how many loops or w/e you want to break out of. Quote Link to comment Share on other sites More sharing options...
Aquablue Posted June 10, 2014 Author Share Posted June 10, 2014 From my experience with Pascal, you can include an argument with Exit; so that when you call it from within a function, the function stops and also returns the value you specified in Exit(). I guess this hasn't been implemented in SCAR? Quote Link to comment Share on other sites More sharing options...
FHannes Posted June 10, 2014 Share Posted June 10, 2014 From my experience with Pascal, you can include an argument with Exit; so that when you call it from within a function, the function stops and also returns the value you specified in Exit(). I guess this hasn't been implemented in SCAR? The engine SCAR 3 uses does not support this feature, no. Quote Link to comment Share on other sites More sharing options...
Aquablue Posted June 11, 2014 Author Share Posted June 11, 2014 Thank you, that is a very clear answer. Quote Link to comment Share on other sites More sharing options...