View Single Post
  #10 (permalink)  
Old 05-28-2008, 01:49 PM
sukatoa's Avatar
sukatoa sukatoa is offline
Senior Member
 
Join Date: Jan 2008
Location: Cebu City, Philippines
Posts: 527
sukatoa is on a distinguished road
Send a message via Yahoo to sukatoa
Quote:
Please suggest me the best practice of using if loop with 'NOT' condition.

For example:
if (rs != null){rs.close();}

if (rs == null){} else{rs.close();}

Which of the above is optimised?
You may code it in favor to what you are expecting....

The first one may be faster than the second one, only if that portion always executes successfully and should be close,

What if rs has 51% chance to be null? therefore the second one is faster than the first one....
__________________
A specific, detailed, simple, well elaborated, and "tested before asking" question may gather more quick replies. hopefully
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Last edited by sukatoa : 05-28-2008 at 01:52 PM.
Reply With Quote