Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Retarded Coding Standards

Name: Anonymous 2012-06-22 1:20

"Always compare equality with a constant on the left, for example if (5 == maxUsers) instead of if (maxUsers == 5). If neither of the expressions being compared are constants, rewrite the condition so it is, for example if (0 == userCount - userLimit) instead of if (userCount == userLimit)."

"For consistency with the previous rule, non-equality comparisons should also be formatted using the same style. For example, use if (0 < userCount) instead of if (userCount > 0), and if (0 < userCount - userLimit) instead of if (userCount > userLimit)."

Name: Anonymous 2012-06-22 15:07

Okay, well what if userCount or userLimit aren't integers, but Strings, or Arrays, or Structs? What if userCount - userLimit doesn't actually make sense because the method - isn't defined for userCount?

Better solution for Object Oriented Programmers:

if userCount.eql? userLimit

Or for functional programmers:

(eql? userCount userLimit)

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List