Say I have a loop like this:
for (int i = 0; i < someint; i++)
{
if (i == somecondition)
{
DoSomething();
continue;
}
doSomeOtherStuff();
}
Versus…
for (int i = 0; i < someint; i++)
{
if (i == somecondition)
{
DoSomething();
}
else
{
doSomeOtherStuff();
}
}
Is there any reason to use one over the other? Or is it just personal preference?
The main language I’m asking this for is Java, but I guess it also applies to most others.
Technically, no, but I find the second one prettier for this particular case.