What does q{...} mean?
Philippe Sigaud
philippe.sigaud at gmail.com
Mon Feb 24 09:09:24 PST 2014
>>> On Monday, 24 February 2014 at 11:41:41 UTC, Gary Willoughby wrote:
>>>> I keep seeing this syntax used a bit and i'm stumped to what it means.
>>>> What is it?
>>>> enum foo = q{
>>>> // ???
>>>> };
>> It's a token string though, not a delimited string. See the
>> section "Token Strings" on that page.
For Gary: the main use is that your IDE / Editor probably does not
know about it and hence does not highlight/colour it as a string. If
you put to-be-mixed-in code inside this token string, it'll be
highlighted as code in editor. It helps catching stoopid mistakes like
writing 'imutable i = foo();'.
More information about the Digitalmars-d-learn
mailing list