ghenry74 Posted November 8, 2007 Report Share Posted November 8, 2007 This is perhaps "just" a style question; however, even for matters of style that fall into the 'personal preference' category, there must be a rationale. (Mustn't there?)I am interested in why, given a variable, an operator and a value, people choose to write either if (variable operator value) -- e.g., if (myItn == 0)or if (value operator variable) -- e.g., if (0 == myInt)I have a strong personal preference on this matter, for which I have a well-thought-out rationale and from which I never vary, and although I have seem many examples of the opposite order, I have never been apprised of the rationale for it.Which order is your choice, and why?Thanks in advance for your response. Quote Link to post Share on other sites
jcl Posted November 9, 2007 Report Share Posted November 9, 2007 (edited) if (variable operator value) -- e.g., if (myItn == 0)Usually reads more naturally.if (value operator variable) -- e.g., if (0 == myInt)Catches ==/= typos.Which order is your choice, and why?The former. Prefer the way it reads, never had trouble avoiding typos, often use assignment in conditionals. Edited November 9, 2007 by jcl Quote Link to post Share on other sites
Tommadness Posted December 30, 2007 Report Share Posted December 30, 2007 I use variable operator integer. I believe this stems from my days of Algebra, where we HAD to write our answers like X=4. Quote Link to post Share on other sites
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.