Join Slack
Unit is like Java's void
# getting-started
d
diesieben07
05/18/2017, 2:42 PM
Unit is like Java's void
r
Ruckus
05/18/2017, 2:43 PM
diesieben07: In a way. Java's
void
plays the roles of both
Unit
and
Nothing
.
d
diesieben07
05/18/2017, 2:44 PM
No, Java does not have a
Nothing
😛
r
Ruckus
05/18/2017, 2:45 PM
Correct. So a function that cannot return still says it's
void
. The link
@sigurdsa
posted explains it pretty well.
d
diesieben07
05/18/2017, 2:46 PM
Yes, I know that. But there is no way to express "this never returns" in Java.
r
Ruckus
05/18/2017, 2:46 PM
Ah, yes. I see what you mean now. That is correct.
4
Views
Open in Slack
Previous
Next
kotlinlang
A modern programming language that makes developers happier.
Powered by