Which one of these if() statements is best?...
Hi,
I am wondering which one of these is better to use in my code:
Code:
//this one:
void handleMouseClick(const int X, const int Y)
{
if(SelectedObject==NULL)
return;
SelectedObject->Move(X, Y);
SelectedObject->Update();
//...
}
//or this one:
void handleMouseClick(const int X, const int Y)
{
if(SelectedObject!=NULL)
{
SelectedObject->Move(X, Y);
SelectedObject->Update();
//...
}
}
They do the same thing. So: Is it totally up to me, or does each of these methods have its pros and cons?
Thanks.