From aa5aca4c524af2795dab562a367d741e3c46629c Mon Sep 17 00:00:00 2001 From: McKayla Washburn Date: Tue, 8 Mar 2022 10:21:14 -0700 Subject: Add `to_string` method to bool.gleam --- src/gleam/bool.gleam | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src') 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" + } +} -- cgit v1.2.3