Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Nested Ifs

We have a programmer who, in his early years, rarely included Braces with his if statements. I found this gem from the past today.if ( FirstExpression ) if ( SecondExpression ) IncreaseCount();else IncreaseCount();Since braces were not used, the compiler matched the else statement with the Nested if. IncreaseCount() will be called whenever the FirstExpression is true and only when



This post first appeared on Code Snippet Of The Day, please read the originial post: here

Share the post

Nested Ifs

×

Subscribe to Code Snippet Of The Day

Get updates delivered right to your inbox!

Thank you for your subscription

×