What does q{...} mean?

1100110 0b1100110 at gmail.com
Mon Feb 24 09:47:55 PST 2014


On 2/24/14, 11:06, Gary Willoughby wrote:
> On Monday, 24 February 2014 at 11:53:00 UTC, anonymous wrote:
>> On Monday, 24 February 2014 at 11:47:02 UTC, Namespace wrote:
>>> 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{
>>>>  // ???
>>>> };
>>>
>>> http://dlang.org/lex.html#DelimitedString
>>
>> It's a token string though, not a delimited string. See the
>> section "Token Strings" on that page.
>
> What are they used for? Simpler for creating code at compile time?

It allows IDE syntax highlighting and code completion to work with 
strings that are going to be mixed in.

You don't have to use it, in fact there's no difference between this and 
a normal string.

It's just nicer.


More information about the Digitalmars-d-learn mailing list