labeled-statements Questions
4
Solved
We are writing a byte-code for a high-level compiled language, and after a bit of profiling and optimization, it became clear that the current largest performance overhead is the switch statement w...
Census asked 21/6, 2011 at 6:49
5
Solved
I just found out about using label s in JavaScript, such as:
for (var i in team) {
if(i === "something") {
break doThis: //Goto the label
} else {
doThat();
}
}
doThis: //Label
doIt();
I'v...
Toscana asked 5/2, 2011 at 12:12
10
Solved
While running a batch file in Windows XP I have found randomly occurring error message:
The system cannot find the batch label specified name_of_label
Of course label existed. What causes this...
Hoofer asked 24/10, 2008 at 6:34
6
I always thought that the labels must be used only with loops but it seems not. Giving such code:
public class LabelTest {
public static void main(String[] args) {
label1: System.out.println("")...
Longitude asked 20/2, 2011 at 15:25
5
Solved
I came across the following valid syntax in JS when looking at svelte library:
$: doubled = 6 * 2;
At first, I thought it was specific for the library, but it works on the Chrome console. What i...
Agneta asked 24/4, 2019 at 12:59
3
Solved
I am getting error while using break statements in labels in java code. This is showing undefined label. It is wrong to write code like this. Please assist me in using it correctly. Thanks in advan...
Endosteum asked 7/2, 2015 at 10:48
1
Solved
I’m watching a talk on JSON hijacking and not 2 minutes in, there is already JavaScript that is unfamiliar to me.
let:let{let:[x=1]}=[alert(1)]
It seems to work on Edge and just alerts 1, but I’...
Lohr asked 2/4, 2018 at 1:44
2
Solved
I have been looking through the forums but I have not found an answer to this question that applies to my situation. I am trying to make a system call to using 'sort' (unix), however, I receive an ...
Bausch asked 21/9, 2017 at 10:19
1
Solved
As is the case in Java where the break statement can be labeled or unlabeled, is there a statement in C which is either the equivalent or achieves the same process?
Decadence asked 22/8, 2017 at 19:52
14
I know everyone hates gotos. In my code, for reasons I have considered and am comfortable with, they provide an effective solution (ie I'm not looking for "don't do that" as an answer, I understand...
Chinoiserie asked 22/11, 2009 at 6:17
2
Solved
So I've seen a lot of cases where labels are being used in for loops to break out, especially with doubly nested loops.
Is this the only case where they can be used? or are there other common uses...
Trickery asked 15/5, 2013 at 1:36
12
Solved
This code just made me stare at my screen for a few minutes:
loop:
for (;;) {
// ...
}
(line 137 here)
I have never seen this before, and I had no idea Java has a "loop" keyword (NetBeans does...
Maybellemayberry asked 29/9, 2010 at 13:3
2
According to the ECMAScript 5.1 spec, section 12.12, any statement can be labelled - and in a brief test my browser accepted a label before any statement. The spec also states that labels are used ...
Shyamal asked 9/1, 2012 at 1:34
6
Solved
var num = 0;
for(var i = 0; i < 10; i++){
for(var j = 0; j < 10 ; j++){
if(i == 5 && j == 5){
break;
}
num++;
}
}
console.log(num)
In the above code, I exp...
Guanine asked 25/2, 2011 at 15:20
4
Solved
I am using this code to weather some circles are overlapping:
iCantThinkOfAGoodLabelName:
x = genX(radius);
y = genY(radius);
for(i in circles) {
var thisCircle = circles[i];
if(Math.abs(x-thisC...
Vinita asked 18/6, 2011 at 3:22
5
Can a LABEL block be used without loop? Any examples?
Alidus asked 21/12, 2009 at 12:50
6
Solved
I'm busy studying for my certification and I stumbled upon a concept I've never even heard before - "Labeled Statements". e.g:
'label' : 'statement'
L1: while(i < 0){
L2: System.out.pri...
Ballet asked 22/8, 2012 at 10:15
1
Solved
I was just browsing the source of JSLint and noticed this piece of code:
// Is this a labeled statement?
//...
if (next_token.labeled !== true || funct === global_funct) {
stop('unexpected_label_...
Danelaw asked 17/7, 2012 at 20:35
2
Solved
I have a code like this:
if(condition1)
{
break MyLabel;
}
while(true)
{
//some code here
MyLabel: if(condition2) break;
//more code here
}
and I get this error:
The label MyLabel is miss...
Epanaphora asked 10/1, 2012 at 11:7
3
Solved
Why do labels exist in javascript?
var i = 0;
usefulLabel://why do I exist?
while(i <= 10){
document.writeln(i);
i++;
if(i > 5)
break;// usefulLabel;
}
The above code doesn't appear to ...
Neurotic asked 24/10, 2011 at 21:23
3
Solved
I recently read about labelled statments in java and the ability to specify a label with the break and continue statements. What other languages support this sort of syntax ?
Abagael asked 20/6, 2010 at 5:40
3
Solved
Is breaking and continuing the only uses of labeled statements in Java?
When have you used Labeled Statements in your programs?
Sorry the code snippet has been deleted. I am splitting the questi...
Goldie asked 25/4, 2010 at 23:46
4
Everywhere across the internet people say that you should avoid using label statements in java. However, I find them very useful in some cases, namely nested loops.
I cannot find satisfactory answe...
Audition asked 12/12, 2009 at 16:31
1
Solved
I am converting some Java code to C# and have found a few labelled "break" statements (e.g.)
label1:
while (somethingA) {
...
while (somethingB) {
if (condition) {
break label1;
}
}
}
Is...
Euniceeunuch asked 10/10, 2009 at 14:52
1
© 2022 - 2025 — McMap. All rights reserved.