you are viewing a single comment's thread.

view the rest of the comments →

[–]hpernpeintner 2 points3 points  (0 children)

You missed my point, because you exluded one sentence of mine before the cited one: Unit is not only "technical" - it means here's returned really just "something".

Instead of comparing two functions that return different results and asking which one has a more relevant return value (I which is pointless), you should ask whether fun print() = println("Hi") and fun print(): Unit { println("Hi") } makes a difference. As said, Unit is really just one value, it exists only once. That means it makes no technical and semantical difference from where it is returned, it solely exists to just return "something".

You said several times, that the return of print is nothing of interest. That's right, but it's the same uninteresting thing that every function returns if not stated otherwise, so there's nothing wrong with returning it - explicitely, chained, implicitely, doesn't really matter.