53
lado
8y

If you know what i mean

Comments
  • 24
    num is still a newbie variable name.
  • 23
    I'm missing the switch-case here. For if a gender gets added later on. Like "hermaphrodite", or "transgender", or "unknown".

    Yes, "unknown" is a valid entry for unborn babies who's gender has not yet been determined.
  • 44
    When I call "getSex()" I expect a return value of "true"
  • 7
    I'd prefer sometime that, separating code and data, and association between value and string.
  • 2
    (also, ternary operator has its uses, but only because it looks more ""cool"" doesn't make it necessarily better)
  • 5
    Why are the comments in wrong order?
  • 2
    @SweetHuman I was wondering why no one responded to that.
    Seems like OP confused 3 and 6.
  • 0
    (ow, my array sex_str needs the explicit size NB_SEX, it would be safer)
  • 9
    function getSex() { return "yes please"; }
  • 2
    @lado one months later they learn better English too
  • 4
    Op was just making a joke you all went full balistic on code review!

    Damn!!
  • 3
    @fredrf what do you expect, when the joke is "look, I'm not a newbie anymore, now I know how to do it", and posted in such a forum?
  • 0
    @Robbatron It depends on where you are pulling your input data from. You could have a gendertypeid field in the database that just maps to a string, like so, in you application to be displayed on the page.

    Personally I would just use enums at that point and be done
  • 1
    @Gauthier I see both views 😁

    But I find it funny that a guy throws a joke and guys don't laugh or say it's a bad joke.

    What people do is analyze.

    I'm just point this out and find it funny 😁😁
  • 5
    one year later
    ...
    return num?"male":"female"
    ...
  • 1
    @Robbatron Using an enum is better, but using a string is just throwing type safety out the window and asking for someone to mis-spell it.
  • 1
    The parameter "num" clearly refers to the number of times the caller tries to get sex. What does the return values actually mean? An URL to a pron site for all num>0 seems more appropriate...
  • 1
    @johmsalas That would require the language to support truthy statements.
  • 0
    did anyone notice that the line count is wrong ?
  • 1
    @Robbatron 😄 it has a couple of mistakes, I wrote it in bed on my phone 2 minutes after waking up :) Here's a fix.
  • 2
    This rant is becoming legendary...
  • 0
    @Robbatron nice. Illuminati confirmed ☠
Add Comment