presidentender
Golden Member
Function 1:
private bool Login()
{
bool loginSucceeded;
//Rest of function; check to see whether the login actually succeeded
//and set loginSucceeded accordingly
return loginSucceeded;
}
Function 2:
private bool Login()
{
bool loginSucceeded;
//Rest of function; check to see whether the login actually succeeded
//and set loginSucceeded accordingly
if(loginSucceeded) { return true; }
else { return false; }
}
Right now, I'm using the style of function 1, but I ran across some code that did it the other way. I couldn't figure out why, but it might be for readability. What do y'all think?
private bool Login()
{
bool loginSucceeded;
//Rest of function; check to see whether the login actually succeeded
//and set loginSucceeded accordingly
return loginSucceeded;
}
Function 2:
private bool Login()
{
bool loginSucceeded;
//Rest of function; check to see whether the login actually succeeded
//and set loginSucceeded accordingly
if(loginSucceeded) { return true; }
else { return false; }
}
Right now, I'm using the style of function 1, but I ran across some code that did it the other way. I couldn't figure out why, but it might be for readability. What do y'all think?