break

Can't break out of nested for loops

I have the following function but despite using the break statement, it doesn't seem to be stopping after it finds a match in the array: private function CheckMatch() { // _playersList is the Array that is being looped through to find a match var i:int; var j:int; for (i= 0; i < _playersList.length...

using continue in a switch statement

I want to jump from the middle of a switch statement, to the loop statement in the following code: while (something = get_something()) { switch (something) { case A: case B: break; default: // get another something and try again continue; } // do something for a handled something d...

Label position in java decompiling output

Hi, I am using jd-gui to decompile a class file, and I got a break label (label1076) as below. In eclipse I got an error compiling because the label is declared after it is used. What is the equivalent java code without using break statement? public List buildChildList() { for (int i = 0; i < size; ++i) { ... for (int i = 0; i < r...

How do I get GDB to break out of a loop?

I can tell GDB to return from a function immediately with return, and call a function with call myFunction. But how do I get it break out of the current loop? i.e. to act as if it's hit a break; statement. Is jump myfile.c:<linenumber> the way to do this? ...

c# exit generic ForEach that use lambda

Does anyone know if it is possible to exit a generic ForEach that uses lambda? e.g. someList.ForEach(sl => { if (sl.ToString() == "foo") break; // continue processing sl here // some processing code } ); This code itself won't compile. I know I could use a regular foreach but for consistency I want to use lamb...

Detect what javascript function is changing a page element on load?

Hey! I have lots of jquery that is running on page load and it's causing one of my elements to disappear (making it style=display:none;). I'm guessing the jquery hide() function is being applied to this element by mistake, but I can't find out which statement is causing it. Is there any javascript,firebug,etc function or tool that will ...

How to Break out of multiple loops at once in C#?

What if I have nested loops, and I want to break out of all of them at once? while (true) { // ... while (shouldCont) { // ... while (shouldGo) { // ... if (timeToStop) { break; // break out of everything? } } } } In PHP, break takes an argument...

Why the c# compiler requires the break statement in switch construction?

Hi there, I'm having hard time understanding, why the compiler requires using break statement. It's not possible to miss it since the fall through is now allowed. I see the reason for the break in C or C++, but is it needed here. Why it's not a built-in behavior to break after a case is over ? Isn't it just a syntax with no semantic? ...

Windows Command Line

Does anyone know how to break out of a for loop when it's typed directly into the windows command-line? I know you can use gotos and labels to break out of it when it's in a batch file, but I can't find anything about breaking out of one on the command line. Here's a simple example: C:> for /l %i in (1,0,1) do @ping -n 1 google.com ||...

How to stop Python program execution in IDLE

I have a python script that uses plt.show() as it's last instruction. When it runs, IDLE just hangs after the last instruction. I get the image but I don't get the prompt back. On other scripts I typically use ctrl-c to break the program (sometimes doesn't work immediately) but how do I get the prompt back with the plt.show()? Ctrl-c do...

What do I put in my Ruby (JRuby) code to break into the debugger?

I'm familiarizing myself with some JRuby code, and I'd like to be able to place a breakpoint in the code and run (as usual) from the command-line, having it break into the debugger when it gets to that point. Is there something I can put in my code to force JRuby to break into the debugger? I've tried running jruby -r debug foo.rb (ins...

Why does this break statement break not work?

I have the following code: public void post(String message) { final String mess = message; (new Thread() { public void run() { while (true) { try { if (status.equals("serviceResolved")) { output.println(mess); Game.log.fine("T...

Why do we need break after case statements?

Why doesn't the compiler automatically put break statements after each code block in the switch? Is it for historical reasons? When would you want multiple code blocks to execute? ...

Please explain the usage of Labeled Statements.

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 question ...

How do I break out of a loop in Scala?

For Problem 4 of Project Euler How do I break out a loop? var largest=0 for(i<-999 to 1 by -1) { for (j<-i to 1 by -1) { val product=i*j if (largest>product) // I want to break out here else if(product.toString.equals(product.toString.reverse)) largest=largest max product } } And does anyone know how to turn nested for l...

Advanced switch statement within while loop?

I just started C++ but have some prior knowledge to other languages (vb awhile back unfortunately), but have an odd predicament. I disliked using so many IF statements and wanted to use switch/cases as it seemed cleaner, and I wanted to get in the practice.. But.. Lets say I have the following scenario (theorietical code): while(1) { ...

Breaking dependencies when you can't make changes to other files?

I'm doing some stealth agile development on a project. The lead programmer sees unit testing, refactoring, etc as a waste of resources and there is no way to convince him otherwise. His philosophy is "If it ain't broke don't fix it" and I understand his point of view. He's been working on the project for over a decade and knows the code ...

Any way to not break on certain errors in Visual Studio 2010?

I'm working on a VS2010 project where I'm using DataAnnotations on my objects to handle validation. However, this is sort of a pain in the butt while trying to do interactive debugging because it keeps pausing VS.Net on validation errors. Obviously, I want to break on some errors, but not these particular types. Am I out of luck and I...

ANDROID: Line Break in XML formatting?

Hi. when editing a String in XML I need to add line breaks. And I wanted to ask what is the RIGHT form when programming for android? Because <br> works but ECLIPSE marks the area as problematic. If I check out suggestions Eclipse tells me that I shall add a end tag </br> - IF I add that the line break dissapears... So the one works but...

HTML prevent line break (between two table tags)

Hello, I have following code: <table> <tr> <td>Table 1</td> </tr> </table> <table> <tr> <td>Table 2</td> </tr> </table> Very unfortunately, a line break is inserted between these two tables. I have tried putting them both in a single span and setting the whitespace to nowrap, but at no avail. Please, ...