Hi there
in C# i can write something like:
for (int x = 0, y = 0; x <= 10 && y <= 10; x++, y++)
{
....
}
working with two vars in the loop. Is there an easy way to do this in Rust?
Thx.
Hi there
in C# i can write something like:
for (int x = 0, y = 0; x <= 10 && y <= 10; x++, y++)
{
....
}
working with two vars in the loop. Is there an easy way to do this in Rust?
Thx.
You can use zip
:
for (x, y) in (0..=10).zip(0..=10) {
...
}
Amazing simple...
thx
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.