Discussion:
@printf and Bool
Conrad Scott
2013-07-02 13:43:16 UTC
Permalink
I tried to use the %d format specifier with @printf to print a Bool
argument but received the error

ERROR: no method convert(Type{Unsigned},Bool)

Other than explicitly casting the Bool to Int64 (for example), is there
some @printf format that will work with Bools?
John Myles White
2013-07-02 13:46:04 UTC
Permalink
I always use %s since I want the text "true" or "false".

-- John
Post by Conrad Scott
ERROR: no method convert(Type{Unsigned},Bool)
c***@public.gmane.org
2013-07-02 14:05:07 UTC
Permalink
Many thanks John, that hadn't occurred to me at all.
Post by John Myles White
I always use %s since I want the text "true" or "false".
-- John
Post by Conrad Scott
ERROR: no method convert(Type{Unsigned},Bool)
Conrad Scott
2013-07-02 14:06:57 UTC
Permalink
Many thanks John, that hadn't occurred to me to try that.
Post by John Myles White
I always use %s since I want the text "true" or "false".
-- John
Post by Conrad Scott
ERROR: no method convert(Type{Unsigned},Bool)
Stefan Karpinski
2013-07-02 16:11:21 UTC
Permalink
Glad that helps. We should, however, perhaps provide all those
integer-boolean conversions.
Post by Conrad Scott
Many thanks John, that hadn't occurred to me to try that.
Post by John Myles White
I always use %s since I want the text "true" or "false".
-- John
Post by Conrad Scott
argument but received the error
ERROR: no method convert(Type{Unsigned},Bool)
Other than explicitly casting the Bool to Int64 (for example), is there
Loading...