A
01/07/2020, 11:00 PMfun getCoffee(cups:Int):String{
if (cups<4){
return "Okay"
}
else {
throw Exception("Too much coffee!")
}
}
Since there is no throws Exception
notation in kotlin, does that mean their is no way for caller function to know before hand? I wrote the following driver code, and there were no Lint warnings and it was getting compiled without any problems:
fun main(args:Array<String>){
for (i in 1..6) {
println(getCoffee(i))
}
}
jme
01/07/2020, 11:04 PM@Throws
annotationStavFX
01/07/2020, 11:29 PM