Hullaballoonatic
06/27/2019, 2:05 AMval foo = bar ?:
3 + 6 + 9 + 2 +
8 + 12
val baz = a && b && c
&& d && e && f
danny
06/27/2019, 4:25 AMPavlo Liapota
06/27/2019, 6:03 AM+
or -
on several lines as I would be forced to put these operators before newline, because of:
val foo = 3
+ 2
println(foo) // prints 3
rook
06/27/2019, 3:48 PM+ 2
is a unaryPlus()
operation, so you should only use +
to start a line if you intend to invoke this functionHullaballoonatic
06/27/2019, 3:50 PMHullaballoonatic
06/27/2019, 3:50 PMrook
06/27/2019, 5:43 PMclass SaySomething(var something: String = "") {
operator fun invoke(action: () -> Unit) { action() }
operator fun String.unaryPlus() { something += this }
fun say() { println(something) }
}
val ss = SaySomething() {
+"Hello world!"
}
ss.say() //Hello world!
Hullaballoonatic
06/27/2019, 6:38 PMHullaballoonatic
06/27/2019, 6:38 PM