View previous topic :: View next topic |
Author |
Message |
csauls
Joined: 27 Mar 2004 Posts: 278
|
Posted: Wed Apr 21, 2004 8:55 am Post subject: foreach(x,y; c) |
|
|
I added a cheap example of using foreach with key/index=>value pairs. It seemed to be lacking... feel free to blast it away if I simply missed it somewhere. _________________ Chris Nicholson-Sauls |
|
Back to top |
|
|
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
Posted: Wed Apr 21, 2004 11:09 am Post subject: |
|
|
No blasting away needed; it looks great to me. Thanks. |
|
Back to top |
|
|
larsivi Site Admin
Joined: 27 Mar 2004 Posts: 453 Location: Trondheim, Norway
|
Posted: Sun Apr 25, 2004 1:11 pm Post subject: |
|
|
Probably an idea to expand your tutorial with a map of char [].
char [][char[]] arr;
really looks confusing. Looks better when doing it like this of course:
alias char [] str;
str [char[]] arr;
This stuff has been mentioned in the NG, but it would be nice to have it in a tutorial. |
|
Back to top |
|
|
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
|
Back to top |
|
|
Xerpher
Joined: 09 May 2004 Posts: 13
|
Posted: Sun May 09, 2004 4:52 pm Post subject: |
|
|
larsivi wrote: | alias char [] str;
str [char[]] arr; |
Wouldn't it be even easier to say this?
Quote: | alias char [] str;
str [str] arr; |
|
|
Back to top |
|
|
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
Posted: Sun May 09, 2004 6:01 pm Post subject: string alias in example |
|
|
Xerpher wrote: | Wouldn't it be even easier to say this?
Quote: | alias char [] str;
str [str] arr; |
|
Yes, that's essentially what I used in the example I posted, but I used string instead of str. |
|
Back to top |
|
|
Xerpher
Joined: 09 May 2004 Posts: 13
|
Posted: Sun May 09, 2004 6:02 pm Post subject: Re: string alias in example |
|
|
jcc7 wrote: | Xerpher wrote: | Wouldn't it be even easier to say this?
Quote: | alias char [] str;
str [str] arr; |
|
Yes, that's essentially what I used in the example I posted, but I used string instead of str. |
Ok just checking. I'm new to D (barely know C++ either) |
|
Back to top |
|
|
|