Saturday, 24 August 2013

Return vs break when closing a function?

Return vs break when closing a function?

Say I have a single-for loop function; would it be best to choose return
or break if there is no mechanic-related preference to it? Or they would
be exactly the same?
void function()
{
for (int i; i<foo; i++)
{
if (something)
// return? break?
}
// nothing else after this
}

No comments:

Post a Comment