Ternary if and ~ does not work quite well

TheFlyingFiddle via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Oct 12 08:39:13 PDT 2015


On Monday, 12 October 2015 at 05:19:40 UTC, Andre wrote:
> Hi,
> 	writeln("foo "~ true ? "bar" : "baz");
> André

"foo" ~ true

How does this compile? All i can see is a user trying to append a 
boolean to a string which is obvously a type error. Or are they 
converted to ints and then ~ would be a complement operator? In 
that case.. horror.


More information about the Digitalmars-d-learn mailing list