Stephen Prochnow
06/11/2020, 7:20 AMand(), or(), not() over Boolean operations like &&, ||, !. Thank you in advance for your answers.elizarov
06/11/2020, 7:23 AMthanksforallthefish
06/11/2020, 7:25 AMand and or not-shortcircuited? meaning both expressions will always be evaluated, with && only the first one if false?elizarov
06/11/2020, 7:26 AMStephen Prochnow
06/11/2020, 7:27 AMthanksforallthefish
06/11/2020, 7:27 AM/**
* Performs a logical `and` operation between this Boolean and the [other] one. Unlike the `&&` operator,
* this function does not perform short-circuit evaluation. Both `this` and [other] will always be evaluated.
*/
public infix fun and(other: Boolean): Booleanelizarov
06/11/2020, 7:28 AMBoolean::add to use with some higher-order function, albeit it is hard to come up with a practical exampleelizarov
06/11/2020, 7:29 AMadd and or are there mostly for completeness, to complement xor which is indeed useful sometimes.Stephen Prochnow
06/11/2020, 7:31 AMJoost Klitsie
06/11/2020, 7:34 AMvar foo: Boolean? = null
val bar = true
val result = foo?.and(bar) ?: false
var other = (foo ?: false) && bar
var yetAnother = foo == true && bar