File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Coding standard - condition order in if statement.

 
Janne A Andersson
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
is there any reason why

would be considered better then

I can't really see it being cosmetical reasons, but I could be wrong...
thanks Jan
 
Janne A Andersson
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got an answer,
it comes into play when you do an equal-test (==), to prevent accidental assignment. With a not equal test it doesn't add anything, more to keep up the habit and for consistency reasons i guess...
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup. See also this thread.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic