X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Futils%2FBooleans.kt;h=bfcb3198ae907fcf2dea2a8c3bb1ddb19d2643cd;hb=03cec6a6772c2d836d94864adddaf544cbe9d72f;hp=3202b820196f67fd719fd3c2df0cfcdb7663a729;hpb=b51bf84d05e317d8a8179d72a788190b350a95a1;p=Sone.git diff --git a/src/main/kotlin/net/pterodactylus/sone/utils/Booleans.kt b/src/main/kotlin/net/pterodactylus/sone/utils/Booleans.kt index 3202b82..bfcb319 100644 --- a/src/main/kotlin/net/pterodactylus/sone/utils/Booleans.kt +++ b/src/main/kotlin/net/pterodactylus/sone/utils/Booleans.kt @@ -4,3 +4,8 @@ package net.pterodactylus.sone.utils * Returns the value of [block] if `this` is true, returns `null` otherwise. */ fun Boolean.ifTrue(block: () -> R): R? = if (this) block() else null + +/** + * Returns the value of [block] if `this` is false, returns `null` otherwise. + */ +fun Boolean.ifFalse(block: () -> R): R? = if (!this) block() else null