Tuesday, December 21, 2010

Coding Best practices

Last week i was trying to explore how the if statement performs under various conditions as shown below.

if( statement 1)
{
if( statement 2)
{ if( statement 3)
{ ...... }
}
}

VS

if( statement 1 && statement 2 && statement 3){ .....}


The results indicate that, the second approach is far better than the first one.Hence, the recommendation would be to use the second approach over the first one
I hope this helps!.
Regards,
-Vinayak

No comments: