Is there a writef () format specifier for bool?

I looked at the documentation for any qualifier , and there seemed to be none. writef() bool

The Chapel program includes: ...

config const verify = false;
/* that works but I want to use writef() to also print a bunch of other stuff*/
writeln("verify = " + verify); 
writef("verify = %<what-specifier-goes-here>\n", verify);

This last statement works fine.

// I guess I could do:

writef( "verify = %s\n",if verify then "true" else "false");
+6
source share
2 answers

Based on the FormattedIOdocumentation, there is no qualifier available in the Chapel formatted IO format. bool

Instead, you can use a generic qualifier ( %t) to print types in formatted IO: bool

config const verify = false;
writef("verify = %t\n", verify);

writeThis readWriteThis . Chopel IO , .

+3

, <specifier> bool FormattedIO

, bool -value Chapel .

A verify .

config const verify    =  false;
var aTrueFalseAsSTRING = "false";

if verify then aTrueFalseAsSTRING = "true";

writef( "verify = %s\n",
         aTrueFalseAsSTRING
         );
-1

All Articles