Re: printing logical variables as "true" and "false"
*** Hendrickson wrote:
Richard E Maine wrote:
<beliavsky@xxxxxxx> wrote:
I would like to print logical variables as "true" and "false" rather
than just "T" and "F", which is what Fortran WRITE statements do. I can
define functions that convert .true. and .false. to the strings "true"
and "false", but is there some edit descriptor I have overlooked?
Nope. I don't know of a language-provided shortcut for this. Your
function is a pretty simple one to write, but I don't know a way to
avoid it.
I think the function has already been written.
print *, merge("true", "false", logical_thingo)
unless I've missed something.
*** Hendrickson
Good thing I added the "unless I've missed something" ;(,
because I missed something.
It should be
print *, merge(" true", "false", logical_thingo)
because merge requires it's first two arguments to have the
same type parameters.
*** Hendrickson
.