galvin Posted February 11, 2011 Share Posted February 11, 2011 Just curious, what is proper programming in cases where you're just doing a simple IF statement where there really is no need for an ELSE. Should you still write out the ELSE? For example, which is proper... if (x=1) { //code here to do something } or if (x=1) { //code here to do something } else { } There would be nothing in the ELSE statement, so is it OK to just leave it out completely (i.e. version #1), or is it proper to still have it listed (i.e. version #2)? Quote Link to comment Share on other sites More sharing options...
btherl Posted February 11, 2011 Share Posted February 11, 2011 #1 is fine. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.