What is a break statement?



Oops, try again. Make sure to use a break statement with each case!

var boss = prompt("Do you want to raid the pension fund, take over a company, or become a Marine?").toLowerCase();

switch (boss){
        var stealthy = prompt("Is your CPA stealthy (Yes or No)?").toLowerCase();
        var ethics = prompt("Do you have any ethics (Yes or No)?").toLowerCase();
        if(stealthy=='Yes'&&ethics=='No') {
            console.log("GREAT! That is a perfect combination!");
        } else { 
            console.log("Sorry, you must have already given up ethics.  Maybe                      another time.");
        var identified = prompt("Have you identified (Yes or No) your target?").toLowerCase();
        var offer = prompt("Have you made an offer (Yes or No)?").toLowerCase();
        console.log("Good, you have a start.");
        } else {
          console.log("To take over a company, you have to decide which company and               make an offer.");
        var strong = prompt("Are you strong (Yes or No)?").toLowerCase();
        var blues = prompt("Do you look good in dress blues (Yes or No)").toLowerCase();
        console.log("I'm not sure what you are choosing.  Click RUN and select raid the pension fund, take over a company, or become a Marine."); 



After each of your case, you must put a break;


A break statement tells to avoid checking the cases that follow up if an earlier case is already satisfied . If none of the case matches then the default is executed . So it is mandatory to use break statement in switch


Is a semi-colon ; the break? I have one but it ran over to the second line. How can I indicated that text has run over onto another line but is part of the whole statement?



It's the same statement but because the editor of codeacademy is not big enough, the semicolon will go to the next line but it is part of the statement.


OK, thanks! I can quit worrying about that!


I think semi colon is only a line break it is not same as the case break; in switch statements


Then what is a case break?


Like I said before break; in a switch indicates the end of the case , meaning that the set of statements to be executed if the case is true is over and tells the control to exit the switch statement .