94
Comments
  • 10
    check = x > y ? true : false;
  • 4
    def compare(x, y)
    x > y
    end
  • 4
    Poor variable naming.
  • 2
  • 0
    @ReturnVoid unless it is for educational purposes. You wouldn't get away with naming vars x and y in a company.
  • 8
    @JavaRules I used to think like you, but...

    Leaving aside the possibility that x and y correspond to coordinates on a Cartesian plane, another good reason to use generic names is when you want a generic function. If you look at a number of standard library calls in any language you'll see that the parameter names often give no clue as to their context. For example, in C you have

    int strcmp(const char *str1, const char *str2)

    Java libraries are the same way, when you get down to basic, generic functions you'll see that more descriptive names would imply logic counter to the function's generic intent
  • 0
    check = lambda x, y: x > y
  • 0
    Also, return is not a function, worry even more about the guy who skips the parenthesis. (in C and C++, I don't know what your screenshot shows)
    Ah, and the totally useless comment is totally useless.
  • 0
    Wait, which one is you?
  • 0
    @ReturnVoid Actually, the point of having it in a function is to hide the logic from the caller, abstraction for the reader, and easier maintenance if the condition changes in the future.
Add Comment