After evaluating the case in the switch statement in Java (and I'm sure other languages), the following case is also evaluated if a control statement such as break or return is not used.
I understand that this is probably an implementation detail, but what are the reasons / reasons why this happens?
Thank!
Because it’s useful to “fail” from one case to another. If you do not need it (as is often the case), a simple one will breakprevent it. On the other hand, if the case did not go by default, there would be no easy way to do this.
break
.
void measureCPD (void) { char setting; switch (DrawerType) { case 1: setting = SV1 | SV7; break; case 0: case 2: setting = SV1; break; case 5: PORTA |= SVx; case 3: case 4: setting = SV1 | SV7; break; default: // Illegal drawer type setting = SV1; } SetValves (setting); }
, case goto .
goto
, , case . , .
, , , case - , , , ( ), (break;), .
case
break;
Source: https://habr.com/ru/post/1742495/More articles:Cannot find controls in FormView.InsertItemTemplate even with DataBound - .netjQuery - Programmatically Trigger Event - javascriptWhat happened to this line? - stringError passing a template function as an argument to another function in C ++ - c ++How to map a database view using Ruby ActiveRecord? - ruby | fooobar.comHow can I access network shares and connections? - windowslimit T to int? - genericsThe C # property is exactly the same as defined in two places - inheritanceС#: Как удалить элементы из коллекции IDictionary> с LINQ? - collectionsRegex: find / replace all substrings without a given string before? - regexAll Articles