projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
🔀 Merge branch “release-80”
[Sone.git]
/
src
/
main
/
kotlin
/
net
/
pterodactylus
/
sone
/
utils
/
Booleans.kt
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
(file)
--- 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 <R> Boolean.ifTrue(block: () -> R): R? = if (this) block() else null
* Returns the value of [block] if `this` is true, returns `null` otherwise.
*/
fun <R> Boolean.ifTrue(block: () -> R): R? = if (this) block() else null
+
+/**
+ * Returns the value of [block] if `this` is false, returns `null` otherwise.
+ */
+fun <R> Boolean.ifFalse(block: () -> R): R? = if (!this) block() else null