I have been referring my new company's code, where I found the code was not wrapped around IF and ELSE so was little bit confusing in flow. For example:
if(user_is_registered)
{
// You are already registered.
//exit
}
//New user's registration code goes here
While my last company was following the other way i.e. :
if(user_is_registered)
{
// You are already registered.
}
else
{
//New user's registration code goes here
}
Like every fresher I am confused which is the best practice to follow with legitimate reasons. Please enlighten me. I tried to find out answers for the same, but could not get. Some of answers are there in which some experts are supporting way 1 some are supporting way 2. Please also suggest me other refs if available. Thank you.