Is this a good practice ... i.e. grouping a default case with another?
switch ($cond){ case 1: ...; break; case 2: ...; break; case 3: default: ...; break; }
It makes sense to do it this way.
In addition, @Ian is correct, but in a limited area. If you want additional features to be applied to case 3 , you will leave it as it is. Until you break , it will move on to the next case .
case 3
break
case
This makes case 3 unnecessary, so I would delete it and leave it as default
default
Source: https://habr.com/ru/post/897163/More articles:Naming data column names - rASP.NET MVC: loading an excel file - asp.net-mvcHTML tag binding with Italic tag - javascriptCan a Scala variable for a loop modify variables outside its scope? - scalaHow to use the field with a type? - genericsMESSAGES vs. while while - join.mm conversion causes Undefined characters for i386 architecture errors - c ++How to determine if the environment is a production or a production as a laureate of service personnel? - environmentHow to run a script and not wait for it in Perl? - cross-platformObtaining an Azure Subscription ID & Deployment Slot (very fast) - azureAll Articles