aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMcKayla Washburn <mckayla@hey.com>2022-03-08 10:21:14 -0700
committerLouis Pilfold <louis@lpil.uk>2022-03-08 17:48:43 +0000
commitaa5aca4c524af2795dab562a367d741e3c46629c (patch)
tree0348c0a72a4266d58bcfac302539cf5060c5a506 /src
parentd032bcb450777875c046d9950f45971e3a47d286 (diff)
downloadgleam_stdlib-aa5aca4c524af2795dab562a367d741e3c46629c.tar.gz
gleam_stdlib-aa5aca4c524af2795dab562a367d741e3c46629c.zip
Add `to_string` method to bool.gleam
Diffstat (limited to 'src')
-rw-r--r--src/gleam/bool.gleam17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gleam/bool.gleam b/src/gleam/bool.gleam
index 92706bf..6728d00 100644
--- a/src/gleam/bool.gleam
+++ b/src/gleam/bool.gleam
@@ -200,3 +200,20 @@ pub fn to_int(bool: Bool) -> Int {
True -> 1
}
}
+
+/// Returns a string representation of the given bool.
+///
+/// ## Examples
+///
+/// > to_string(True)
+/// "True"
+///
+/// > to_string(False)
+/// "False"
+///
+pub fn to_string(bool: Bool) -> String {
+ case bool {
+ False -> "False"
+ True -> "True"
+ }
+}