diff options
author | McKayla Washburn <mckayla@hey.com> | 2022-03-08 10:21:14 -0700 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2022-03-08 17:48:43 +0000 |
commit | aa5aca4c524af2795dab562a367d741e3c46629c (patch) | |
tree | 0348c0a72a4266d58bcfac302539cf5060c5a506 | |
parent | d032bcb450777875c046d9950f45971e3a47d286 (diff) | |
download | gleam_stdlib-aa5aca4c524af2795dab562a367d741e3c46629c.tar.gz gleam_stdlib-aa5aca4c524af2795dab562a367d741e3c46629c.zip |
Add `to_string` method to bool.gleam
-rw-r--r-- | src/gleam/bool.gleam | 17 |
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" + } +} |