add test files

This commit is contained in:
pTalanov
2012-02-27 21:55:57 +04:00
parent 645a3a9f2f
commit c21ea8aa86
240 changed files with 16998 additions and 0 deletions
@@ -0,0 +1,23 @@
// Return null if str does not hold a number
fun myParseInt(str : String) : Int? {
try{
return parseInt(str)
} catch (e: NumberFormatException) {
println("One of argument isn't Int")
}
return null
}
fun main(args : Array<String>) {
if (args.size < 2) {
print("No number supplied");
} else {
val x = myParseInt(args[0])
val y = myParseInt(args[1])
// We cannot say 'x * y' now because they may hold nulls
if (x != null && y != null) {
print(x * y) // Now we can
}
}
}