noob Q: declaring string variables

Ellery Newcomer ellery-newcomer at utulsa.edu
Sat May 29 15:14:45 PDT 2010


On 05/29/2010 04:38 PM, Duke Normandin wrote:
> Back again...
>
> As an introductory tutorial, I'm now using:
>
> http://www.dsource.org/projects/tutorials/wiki/InitializingVariablesExample
>
> BTW, somebody fix that page - the `writefln' statements are missing
> the %d and %s.
>
> char[] password = "sesame";
>
> didn't work on my MacOS X box. Why?

Maybe you're using d2, which types string literals differently than d1?
rewrite to

string password = "sesame";

Or maybe you attempted to modify the contents of password, which 
shouldn't be done for d1 or d2.
rewrite to

char[] password = "sesame".dup;

>
> [sidebar]
> Why is every D tutorial I've touched upon so far, been frigged up?
> This is NOT good advocacy, people! Bad advertising! Where is the good
> stuff hiding? L8r...
>

Good question. I really can't think of any tutorials I used when I was 
learning D, past the spec and compiler sources. And the tango book.

I bet Andrei's book will fit the bill nicely. I rather like his writing 
style, in spite of all the puns.


More information about the Digitalmars-d-learn mailing list