December 15, 2003 For each syntax sugar | ||||
---|---|---|---|---|
| ||||
char [] a; //Parhaps instead of foreach (int i, char c; a) {} //This could be used, when we want the standard foreach behavior, //where the first is the index and the second is the value. foreach (i, c; a) {} -Anderson |
December 15, 2003 Re: For each syntax sugar | ||||
---|---|---|---|---|
| ||||
Posted in reply to J Anderson | hm.. you're hitting a serious point here, namely the point of implicit automagic type deduction (or so:D)... wich is a very interesting way to implement templates, too... template max(a,b) { if(a > b) return a; return b; } similar to C macros actually:D not sure where that all goes, but its an interesting direction to think about.. In article <brjoa1$1re5$1@digitaldaemon.com>, J Anderson says... > >char [] a; >//Parhaps instead of >foreach (int i, char c; a) {} > >//This could be used, when we want the standard foreach behavior, //where the first is the index and the second is the value. foreach (i, c; a) {} > >-Anderson > |
Copyright © 1999-2021 by the D Language Foundation