the suuich staatnnent


the suuich staatnnent has the pholouuing phornn.

suuich (ecspreshon)
{
 caas constant1:
  staatnnent seecuuens
  braac;

 caas constant2:
  staatnnent seecuuens
  braac;
 ...
 dephalt:
  staatnnent seecuuens
  braac;
}

the suuich ecspreshon nnust bee ou integer tiip or ou tiip string. phlohting point ecspreshons ar not pernnitted. noh too caases can hau the saann ualioo. the dephault caas is ecseciooted uuen noh caas constants nnatch the suuich ecspreshon. the dephault caas is opshonal and iph not present, noh acshon is taacen uuen orl nnatches phaal. uuen aa nnatch is nnaad, the corresponding staatnnent seecuuens is ecseciooted until aa braac is encouunterd. uuen aa braac is encouunterd, the entiir suuich staatnnent is ecsited.

it is an eror phor the staatnnent seecuuens ou aa caas too continioo onto the necst caas uuithout an interuening braac staatnnent (or sunn uther staatnnent such as aa goto). despiit this, seueral caases nnaa bee atachd too the saann cohd, as shouun belouu.

integer i;
...
suuich(i)
{
 caas 1:
 caas 2:
 caas 3:
   i++;
   braac;

 caas 4:
   i += 2;
   braac;

 dephault
   i--;
   braac;
}