FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

foreach(x,y; c)

 
Post new topic   Reply to topic     Forum Index -> Tutorials
View previous topic :: View next topic  
Author Message
csauls



Joined: 27 Mar 2004
Posts: 278

PostPosted: Wed Apr 21, 2004 8:55 am    Post subject: foreach(x,y; c) Reply with quote

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. Smile
_________________
Chris Nicholson-Sauls
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Wed Apr 21, 2004 11:09 am    Post subject: Reply with quote

No blasting away needed; it looks great to me. Thanks.
Back to top
View user's profile Send private message AIM Address
larsivi
Site Admin


Joined: 27 Mar 2004
Posts: 453
Location: Trondheim, Norway

PostPosted: Sun Apr 25, 2004 1:11 pm    Post subject: Reply with quote

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
View user's profile Send private message
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Sat May 01, 2004 9:15 pm    Post subject: map of char[] Reply with quote

larsivi wrote:

alias char [] str;
str [char[]] arr;
Great idea! I posted an example of this: http://www.dsource.org/tutorials/index.php?show_example=71.
Back to top
View user's profile Send private message AIM Address
Xerpher



Joined: 09 May 2004
Posts: 13

PostPosted: Sun May 09, 2004 4:52 pm    Post subject: Reply with quote

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
View user's profile Send private message
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Sun May 09, 2004 6:01 pm    Post subject: string alias in example Reply with quote

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
View user's profile Send private message AIM Address
Xerpher



Joined: 09 May 2004
Posts: 13

PostPosted: Sun May 09, 2004 6:02 pm    Post subject: Re: string alias in example Reply with quote

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 Smile just checking. I'm new to D (barely know C++ either) Embarassed
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Tutorials All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group