On 01/22/2012 11:08 AM, bearophile wrote:
Max Klyga:
If you want to declare and initialize several variables in the for
loop, you can do it if they are of the same type:
for (int x = 0, y = 0; ...; .++x, ++y) { ... }
And if you need different types this sometimes is enough:
void main() {
for (auto x = 0, y = 0.0; x< 10; x++, y++) {
}
}
Bye,
bearophile
This is an ugly solution (and I'm not 100% sure it's valid D) but:
/+++++++++++++++++++++++++++++/
void main() {
{
short y = 0;
int x = 0;
for (; x < 10; ++x, ++y)
{
}
}
}
/+++++++++++++++++++++++++++++/