object cli {
val HELP_MSG = "Usage: arg1 - number 1, arg2 - number 2"
def main(args: Array[String]): Unit = {
if (args.length != 2) {
System.err.println(HELP_MSG)
return
}
var num1: Int = 0
var num2: Int = 0
try {
num1 = args(0) toInt
} catch {
case ex: NumberFormatException =>
System.err.println(ex)
return
}
try {
num2 = args(1) toInt
} catch {
case ex: NumberFormatException =>
System.err.println(ex)
return
}
printf("%d\n", num1 + num2)
}
}