How do I make a skeleton statement that displays the second case block after the display of a case block (java In: cases without brakes).
Switch (Step) {Case 0: Do Something; Case 1: Do Something More; Case 2: etc ...; break; Default: Do something else; }
Thanks for the help!
If you do not use 0 | 1 | 2 / /> You can use a list of functions as a solution such as this:
DIF switch [T] (I: T) (verb: (t, () = & Gt; unit) *) (default: => unit) = {val function = actions.dropWhile (_._ 1! = I) .map {_._ 2} If (actions.isEmpty) default is the other Works .foreach {_ ()}} Gt; & Gt; {() = & Gt; Println ("do 0")}, 1 - & gt; {() = & Gt; Println ("do 1"), 2 - & gt; {() = & Gt; Println ("do 2") return return // return), 3 - & gt; {() = & Gt; Println ("do 3")} (default = Println ("default")) myMethod (1) // do 1 // do 2 myMethod (3) // do 3 myMethod (5) // default
Comments
Post a Comment