Ad
  • Default User Avatar

    CodeWars voters seem to heavily prefer clever one-liners over readability or performance. There might be a way to influence that in a better direction ("better" in the "actually being a developer" sense)

  • Default User Avatar

    Another problem: The description is ambiguous, and the submission tests give no useful feedback for figuring out the issue. "Update whatever key is there, symbol or string" can be interpreted two ways. This is the way I read it, that was rejected:

    h = { :one => 1, "one" => 2}
    h._one = 3   # gives h = { :one => 3, "one" => 3}
    

    This is the way that's actually accepted:

    h = {:one => 1, "one" => 2}
    h._one = 3  # gives h = {:one => 3, "one" => 2}
    
  • Default User Avatar

    Regarding your tests: Semicolons at the end of Ruby lines are allowed, but not idiomatic (nor recommended).

  • Default User Avatar

    Not only is || better by convention, it also binds higher, which will prevent you from having to put parentheses in all kinds of silly places that don't make sense for booleans but do make sense for flow control.

  • Default User Avatar

    The first time I read it, I thought we were supposed to actually enumerate all the possible outcomes (and the function name itself says "all possible outcomes", not "count all possible outcomes"). This could use a rewrite, because enumerating them all is a bit more involved.