Implement a function which will convert the given boolean value into its string representation.
So for the boolean false, return "false"
and for t...
For further actions, you may consider blocking this person and/or reporting abuse
shortest version I can think of:
javascript
or a more safe version that wont print
null
orundefined
, rather it will convert it to true/false depending on its "truthiness":javascript
My solution that is submitted to Codewar
My another solution that is accepted
int
andchar
type.C using _Generic. feel free to contribute
Ruby
there already exists a function
to_s
.If you want another one, here it is
It will work without the
!!
I just wanted to make sure it will work even if anything else is passedRust
1. return an owned
String
:or (on nightly)
or
2. return a reference to a string embedded in the binary:
someone in discord golfed that to
but idk idk :v
JavaScript
JavaScript
That's pretty heavyweight!
value.toString()
works, too.Yes, mine is really really heavy, just tried something no one could think of.
Some go here
Python:
C#
bool.TrueString.ToLower()
bool.FalseString.ToLower()