One way to look at foreach as not so bad
Tom S
h3r3tic at remove.mat.uni.torun.pl
Fri Oct 20 18:53:57 PDT 2006
Julio César Carrascal Urquijo wrote:
> Bill Baxter wrote:
>> Maybe I can get used to this version that works now:
>> obj.each( (int i) {
>> wrietfln(i);
>> })
>>
>> But it just looks weird to have my loop body inside the parens, and
>> will look even weirder if nested
>> obj.each( (Obj c) {
>> c.each( (int i) {
>> writefln(i);
>> })
>> })
>
> I don't understand your point. You can already write something like:
>
> obj.each = (int i) {
> writefln(i);
> };
Yup, or
obj.each in (int i) {
writefln(i);
};
But it will only look like a loop of some sort. Neither continue, break
nor return will work in its body.
The trailing delegate extension would make life easier *hint* *hint* ;)
More information about the Digitalmars-d-announce
mailing list