Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-07-2004, 03:30 PM   PM User | #1
123altoids
New to the CF scene

 
Join Date: Oct 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
123altoids is an unknown quantity at this point
question on break statements

I am relativly new to programming, and have a question about break statements.

is there any way to create a break statement that will break you out of more than one loop, not just the one you are currently in?
or, is there any way to go from one point in a program to another, with having to write a if-else statement?

also, if i have this: while(ytotal<21 && deci!=s){
lot's of code....
}

if there any way to make the "s" a character, not a variable?

thanks, 123altoids

Last edited by 123altoids; 11-07-2004 at 03:52 PM.. Reason: forgot to add a quetsion.
123altoids is offline   Reply With Quote
Old 11-07-2004, 04:42 PM   PM User | #2
liorean
The thread killer


 
Join Date: Feb 2003
Location: Umeå, Sweden
Posts: 5,575
Thanks: 0
Thanked 84 Times in 75 Posts
liorean will become famous soon enoughliorean will become famous soon enough
Yes. Any kind of statement may have a label. They look like this:
Code:
label: statement
The label part must be a valid identifier, but it does not share namespace with any other type of identifier. Thus, you may have a label and a variable with the same name. The JavaScript engine will know when you are using the variable and when you are using the label.

The break statement looks like either of these:
Code:
break;
break label;
The first one can only be used in loops, and will abruptly terminate the directly enclosing loop or switch statement. The second one may be used inside the label statement with specified label, and will abruptly terminate the statement.
__________________
liorean <[lio@wg]>
Articles: RegEx evolt wsabstract , Named Arguments
Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

Last edited by liorean; 11-07-2004 at 04:45 PM..
liorean is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:48 AM.


Advertisement
Log in to turn off these ads.