473,804 Members | 2,225 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How does the break statement work?

For the first time, I'm attempting to write a small Javascript program
using one on the online reference sites. I need some confirmation as
to the behaviour of the break statement.

In the following code:

for ( row = 0 ; row <= 7 ; row++ ) A <----
{
for ( col = 0 ; col <=7 ; col++ ) B <----
{
if ( check ( row, col ) == "pass" )
break ;
}
}
}

Where will control pass to once the break statement is executed?
Will it continue with the first 'for' statement (A) or the second (B)?

Also my 'check' function needs to pass an indication as to it's
success or failure. It does it by:

return ( "pass" ) ;

Am I doing it correctly?

Any links to useful reference sites would be welcomed.
Mar 20 '07
22 2541
Cogito wrote on 22 mrt 2007 in comp.lang.javas cript:
>>
I hope you mean "area" as the name of a js variable.

for <area .. please ask a html NG.


Actually I did not. It was just a word I picked at random. I was just
wondering if there is a way of detecting typos other than careful
scrutiny.
JS being a easy comlpiance language,
no that usually is not possible.
[VBS has "option explicit"]

Some help may come from using an editor with code colouring,
like:

<http://www.editpadpro. com/>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 22 '07 #21
In article <Xn************ ********@194.10 9.133.242>,
"Evertjan." <ex************ **@interxnl.net wrote:
Cogito wrote on 22 mrt 2007 in comp.lang.javas cript:
>
I hope you mean "area" as the name of a js variable.

for <area .. please ask a html NG.

Actually I did not. It was just a word I picked at random. I was just
wondering if there is a way of detecting typos other than careful
scrutiny.

JS being a easy comlpiance language,
no that usually is not possible.
[VBS has "option explicit"]

Some help may come from using an editor with code colouring,
like:

<http://www.editpadpro. com/>
or TextWrangler.

Cogito, you will need to test your code? Does it do what you expect in a
variety of conditions?
Mar 22 '07 #22
In comp.lang.javas cript message <u2q403ltf55ka1 475809i9jomnjl1 ns8g5@4ax.
com>, Thu, 22 Mar 2007 11:31:53, Cogito <no****@nospam. nospamposted:
>Actually I did not. It was just a word I picked at random. I was just
wondering if there is a way of detecting typos other than careful
scrutiny.
Well, if the identifiers you choose are all standard English (or other)
words, a spelling-checker will show those that are not.

Or you could run your code through a program that separates out all the
"word"s, sorts them, and counts how many times each is used. Those used
only once ...

In many cases a typo will result in the attempted use of an undefined
variable in a manner that will be detected, provided that your test uses
that variable. Because of the nature of the language and the speed of
computers nowadays, it pays to test early and test often.

It's a good idea to read the newsgroup c.l.j and its FAQ. See below.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v6.05 IE 6
news:comp.lang. javascript FAQ <URL:http://www.jibbering.c om/faq/index.html>.
<URL:http://www.merlyn.demo n.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Mar 22 '07 #23

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

Similar topics

1
18903
by: Jay | last post by:
G'day all This registration form checks for the submit button then displays the next form from the include statement. But before it displays the next form it will check to make sure the user has entered details correctly and give error messages of whats missing before displaying the original form again. My problem is that I can't exit from the 'if' statement, it brings up the first form as desired, but I can't get it to quit there. I...
5
1729
by: Colleyville Alan | last post by:
I have an application that uses SQL. I am writing a new piece to it, so I used the same approach that worked before. I set up a string and add to it, i.e. strMySql = "some Sql Statement" and then strMySql = strMySql + "some other new statement". The program keeps crashing saying I am running an invalid operation. I go to debug.print and copy the contents of the strMySql to the sql window. Sure enough, where the sql statement wrapped...
8
24801
by: Sivas | last post by:
Hi, Can anyone tell me why this does not work: --------------------------------------------- float b = 2.51F; switch(b) {
1
1475
by: Neo | last post by:
I am in dire need of a break statement in VB.NET language. I have several pieces of code that would have much cleaner look and much less deeper if/else/endif nests IF VB.NET HAS A BREAK STATEMENT OR SOMETHING SIMILAR. Will VB.NET has a break statement in the coming Whidbey release?
8
2028
by: Howard Kaikow | last post by:
I got bored today, so I decided to rewrite the code in KB article 316383 to decrease the number of object references. This resulted in a number of nested With ... End With. The original code had a Dim r As Integer, c As Integer shortly before a For Next.
18
2131
by: sunny | last post by:
Hi Why does C allows declaration of variable inside switch block. ex: foll prg does not gives "undeclared "b" error msg. but also does not initialize b to 20 int a=1; switch(a) { int b=20; case 1: printf("b is %d\n",b);
26
10226
by: Alexander Korsunsky | last post by:
Hi! I have some code that looks similar to this: -------------------------------------------- char array = "abcdefghij"; for (int i = 0; i < 10; i++) {
38
6137
by: larry | last post by:
I am looking at some code which process an uploaded file and it has loops like: for(;;){ // for([two semicolons){ what is the function of the two semicolons? loop until break? I've tried to google it but the text filter seems to remove the semicolons.
2
10014
boss32178
by: boss32178 | last post by:
Ok I get this error when i try to run the web app. foreach statement cannot operte on variables of type 'object' does not contain a public definition for 'GetEnumerator' here is the code #region Number String public string MyNum(System.Object MyString) { string temp; foreach (string mylet in MyString)
0
9715
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9595
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10352
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9175
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7642
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6867
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5535
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3835
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.