github.com/neugram/ng@v0.0.0-20180309130942-d472ff93d872/eval/testdata/switch10.ng (about)

     1  invalid := true
     2  cases := 0
     3  
     4  switch 1 {
     5  case 0:
     6  	panic("ERROR-1")
     7  case 1:
     8  	cases++
     9  	fallthrough
    10  case 2:
    11  	cases++
    12  	fallthrough
    13  default:
    14  	cases++
    15  	invalid = false
    16  case 4:
    17  	cases++
    18  	panic("ERROR-2")
    19  }
    20  
    21  if invalid {
    22  	panic("ERROR-3")
    23  }
    24  
    25  if cases != 3 {
    26  	panic("ERROR-4")
    27  }
    28  
    29  print("OK")