object Case1 { def main(args: Array[String]): Unit = { val ch:Char = '1' var sign:Int=0 var digit:Int=0 ch match{ case '+' => sign = 1 case '-' => sign = -1 case _ if Character.isDigit(ch)=>digit = Character.digit(ch,10) case _=>sign = 0 } } }
object Case1 { def main(args: Array[String]): Unit = { val ch:Char = '1' var sign:Int=0 var digit:Int=0 ch match{ case '+' => sign = 1 case '-' => sign = -1 case _ if Character.isDigit(ch)=>digit = Character.digit(ch,10) case _=>sign = 0 } } }