3 ms·
Kotlin: function parseFile(file: File?) { val file = file ?: throw Exception("File must exist") } (Not the only way to do it, but in general I
by smichel17 6y ago
Kotlin:
function parseFile(file: File?) {
val file = file ?: throw Exception("File must exist")
}
(Not the only way to do it, but in general I really like the language's economics).
- ByteJockey 6y agoI'm pretty sure a function declaration in Kotlin is fun, not function.
- smichel17 6y agoYes, you're right. I copy-pasted from the previous example on my phone and missed that change.
- ByteJockey 6y agoHappens to everyone. You have a nice day.