View Full Version : Resolved Killing a function
08-18-2008, 09:09 PM
Hi, im wondering if theres a way to kill a function from executing any further without having to implement an if statement?
08-18-2008, 09:15 PM
Without an if statement (or eqivalent) how will you know whether or not to kill the function?
08-18-2008, 09:50 PM
by sending a variable effectively as a bool. So if its true, kill the function.
08-18-2008, 09:52 PM
You still have to check it, no?
return statement (http://www.golivecentral.com/pages/txttut/jstut/return.shtml) will stop execution in the function.
08-18-2008, 10:01 PM
Im trying to make an ajax near instant messenger for someone, so im needing to check the posts incase they are blank. But ive set it so the user can either press enter or press a button. The key press is great apart from one pain in the *** of a bug, and the button isnt. With the keypress it is checked in a seperate function (i know, long way for a shortcut) and is then passed to the function that does the ajax calls along with a bool variable which tells if whether or not it is the button that was pressed. If it was the button then do checks, otherwise, dont.
Ive got it working with an added if else statement, but isnt exactly practical. nor space friendly (i know only about 30 bytes).
But that "function" return will be perfect. Thanks
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.