473,407 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

killing the execution of code

I want to stop the execution of the code when the value of k>100 in
the function

function aa()
{
if (k>100)

{

//command to kill the execution

}
}

I saw the break to break the loop, but I'm trying to just stop the
javascript function from continueing execution. I can work around it
in other ways, but that would require alot of redundant code or
another function, both of which I'd like to avoid.

Please help me with this
Dec 13 '07 #1
3 1466
wrote on 13 dec 2007 in comp.lang.javascript:
I want to stop the execution of the code when the value of k>100 in
the function

function aa()
{
if (k>100)

{

//command to kill the execution

}
}

I saw the break to break the loop, but I'm trying to just stop the
javascript function from continueing execution. I can work around it
in other ways, but that would require alot of redundant code or
another function, both of which I'd like to avoid.
This is contrary to moduled programming, and would be a shame to have
introduced.

I am glad that it is not possible. A function ends when it returns
[something or nothing].

The global program ends, when there is no more global code.

=================================================

That being said, it is simple to do in browser js:

function aa(k) {
if (k>100) {
window.location.href = 'http://cnn.com/';
};
};

Though this is not what you probably ment,
it does what you asked.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Dec 13 '07 #2
po********@gmail.com wrote:
I want to stop the execution of the code when the value of k>100 in
the function

function aa()
{
if (k>100)
{
//command to kill the execution
}
}
I saw the break to break the loop, but I'm trying to just stop the
javascript function from continueing execution. I can work around it
in other ways, but that would require alot of redundant code or
another function, both of which I'd like to avoid.
Please help me with this
Have you thought of just using return ?

function aa()
{
if (k>100)
{
return; //command to kill the execution
}
}
Dec 13 '07 #3
gmail.com wrote:
I want to stop the execution of the code when the value of k>100 in
the function

function aa()
{
if (k>100)

{

//command to kill the execution

}
}

I saw the break to break the loop, but I'm trying to just stop the
javascript function from continueing execution. I can work around it
in other ways, but that would require alot of redundant code or
another function, both of which I'd like to avoid.
return ...

RTFM.
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
Dec 13 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Colin Steadman | last post by:
I have created a function to kill all session variables that aren't in a safe list. This is the function - Sub PurgeSessionVariables For Each Item In Session.Contents Select Case Trim(Item)...
1
by: krose | last post by:
Hi Using a couple of examples on CodeProject.com I've create a nice little shell extension (adds some custom menus for proprietary file types). Everything is working fine, except I can't get it...
14
by: Rob Meade | last post by:
Hi all, Having created a secure login, and then create session variables to detect wether or not a user is logged in - I would now like to be able to off a log out page! :) I have found the...
3
by: kunal.kewalramani | last post by:
I'm opening an Excel file using ASP.NET, but Excel process remains it is not killed, I tried killing it by using Quit() that is also not working, if anybody have any solution for this please help me...
2
by: Stu | last post by:
Hi, I have an asp.net page that lists all running processes on the server using the script below: Dim p As Process For Each p In Process.GetProcesses sb.Append(p.ProcessName)...
3
by: Phill. W | last post by:
Here's another little challenge. I have a Form from which lots of others will be derived. One of the base Form properties is a communication "channel" to an external application. If this...
39
by: clintonG | last post by:
This is not about starting a fight but an observation that seems to be proving itself on its own merit and is therefore simply a point of conjecture. I did not get serious about writing software...
18
by: J.K. Baltzersen | last post by:
To whomever it may concern: I am using MS Visual C++ 6.0. I have a process A which instantiates an object C. At a later point the process A creates the thread B. The thread B has access...
6
by: Roger Heathcote | last post by:
sjdevnull@yahoo.com wrote: <snip> Fair point, but for sub processes that need to be in close contact with the original app, or very small functions that you'd like 100s or 1000s of it seems...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.