aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gleam/bool.gleam25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/gleam/bool.gleam b/src/gleam/bool.gleam
index 0792057..707d295 100644
--- a/src/gleam/bool.gleam
+++ b/src/gleam/bool.gleam
@@ -30,6 +30,31 @@ pub fn negate(bool: Bool) -> Bool {
}
}
+/// Returns the nor of two bools
+///
+/// ## Examples
+///
+/// > nor(False, False)
+/// True
+///
+/// > nor(False, True)
+/// False
+///
+/// > nor(True, False)
+/// False
+///
+/// > nor(True, True)
+/// False
+///
+pub fn nor(a: Bool, b: Bool) -> Bool {
+ case a, b {
+ False, False -> True
+ False, True -> False
+ True, False -> False
+ True, True -> False
+ }
+}
+
/// Returns the exclusive or of two bools
///
/// ## Examples