For Loops: Which Method Is Better?
Hello! Writing some code recently I came up with two different ways of doing for loops/statements.
Method 1:
Code:
for (int iii = 0; iii < 5; iii++)
{
SomeStatement;
SomeOtherStatement;
AnotherStatement;
}
Method 2:
Code:
for (int iii = 0; iii < 5; iii++)
SomeStatement;
for (int iii = 0; iii < 5; iii++)
SomeOtherStatement;
for (int iii = 0; iii < 5; iii++)
AnotherStatement;
As far as I can tell both methods are equivalent (please correct me if I'm wrong)
Assuming both do the exact same thing, which would generally be preferred? Thanks!