Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I agree, but would go with:

    return a < b ? -1 : a > b;
This does the right thing, but removes the nested tertiary which to me is a big win.


What language? Those are different types.


I assumed C, and both values are of type int so they match.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: