JavaScript

Moderators: None (Apply to moderate this forum)
Number of threads: 2058
Number of posts: 5158

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
exit functions prematurely Posted by superjoe30 on 24 Apr 2002 at 10:23 AM
ditto.
How do I?


Visual Basic
~Andy~SuperJoe30~
My Website:
http://www.geocties.com/joesarcade
JavaScript


Report
Re: exit functions prematurely Posted by Secret_Doom on 24 Apr 2002 at 6:34 PM
Hum... Perhaps you could put the entire function into a WHILE command. Then, in order to end it at any time, you would only have to change a variable:

<script language="Javascript">
function func1 () {
  while (run==1) {
    // ACTIONS
  }
}
</script>
run=1
func1()


To terminate that function, you would just have to 'run' to any other value than 1

Is that what you wanted??

-- Secret_Doom - Leonardo Pignataro --

secret_doom@hotmail.com
www.batch.hpg.com.br

: ditto.
: How do I?
:

: Visual Basic
: ~Andy~SuperJoe30~
: My Website:
: http://www.geocties.com/joesarcade
: JavaScript
:

:

Report
Re: exit functions prematurely Posted by superjoe30 on 25 Apr 2002 at 10:38 AM

: Is that what you wanted??
:
: -- Secret_Doom - Leonardo Pignataro --
:
Sure, but it seems like there would be a command for it.
I will use your way, but if you find a command for it, please tell me!!!


Visual Basic
~Andy~SuperJoe30~
My Website:
http://www.geocties.com/joesarcade
JavaScript



Report
Re: exit functions prematurely Posted by Ynot on 17 May 2002 at 4:25 AM
:
: : Is that what you wanted??
: :
: : -- Secret_Doom - Leonardo Pignataro --
: :
: Sure, but it seems like there would be a command for it.
: I will use your way, but if you find a command for it, please tell me!!!
:

: Visual Basic
: ~Andy~SuperJoe30~
: My Website:
: http://www.geocties.com/joesarcade
: JavaScript
:

:
:

I haven't tried it myself but java has something called 'return'

This MIGHT work:

function int functionName(){
:
:
if( I_want_to_exit == 1 )
return 0;
else{
:
:
}

// And you MUST include this at the end of the function
return 0;
// although the '0' can be replaced by any int value
}

As I said I don't know if it will work in javascript but it works in
java...
____________________________

Forever trust in who we are,
And nothing else matters.
-Metallica_
____________________________




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.