Swift correct break multi-layer switch -
i'm rewriting code java swift , need break multi-layered switches right way. in java looks :
block0 : switch (topswithch) { case one: { switch (innerswitch) { case insidecase: { if (something){ break block0; } // etc
so, i'm breaking 1 switch another. how do in swift ?
this it'd in swift. did in playground hardcoded values variables:
let topswitch = 1 let innerswitch = 4 let 1 = 1 let insidecase = 4 let = true block0 : switch (topswitch) { //first switch labeled "block0", switching on topswitch case one: //topswitch 1, 1 one switch (innerswitch) { // switching on innerswitch case insidecase: // both 1 if (something){ // if true break block0; // break "block0" } default: break // else } default: break // else }
Comments
Post a Comment