ZNorQ 0 Posted August 20, 2007 I've browsed through several scripts, and some of them end with if (true) exitWith {}; Is this really necessary, and if so - why? ZNorQ Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted August 21, 2007 It's not. Share this post Link to post Share on other sites
dr_eyeball 16 Posted August 21, 2007 I don't recommend it, since if you start using #include, it will prematurely terminate the script. Share this post Link to post Share on other sites
the unknown 0 Posted August 21, 2007 This is related to it so i tought it wasnt usefull to make a seperate topic, is it true the normal exit doesnt work for sqf as stated in the wiki? EXIT I never understood the change so mabey someone can explain how to have it work like the normal exit as soon as it hits the scripts ends. Share this post Link to post Share on other sites
dr_eyeball 16 Posted August 21, 2007 Pretty sure WIKI is right. In SQF, you'd often have code with a condition for exiting, like: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (!leader player) exitWith { hint "You must be leader to perform this command."; // this will now terminate this script here. }; // otherwise resume with normal execution of script Share this post Link to post Share on other sites
ZNorQ 0 Posted August 21, 2007 Pretty sure WIKI is right. In SQF, you'd often have code with a condition for exiting, like:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (!leader player) exitWith { hint "You must be leader to perform this command."; // this will now terminate this script here. }; // otherwise resume with normal execution of script But, is the if {} exitWith {} statement the only way to exit a script prematurely? I find it strange that your have to pose a question to force an exit to a script. The exit statement should have been just as valid for sqf files, as for sqs... ZNorQ. Share this post Link to post Share on other sites
ZNorQ 0 Posted August 21, 2007 It's not. Hehe, ok. Thanks for the feedback. ZNorQ. Share this post Link to post Share on other sites