Ad
  • Custom User Avatar

    only if the possible points can be a float or the boundary is changed to be inclusive

  • Default User Avatar

    Check that the number isn't negative and, what if it is? Throw an error? There's nothing wrong with throwing an error. In fact, the only real problem is that spam(-1) returns "" instead of throwing the error. But since behavior for negative numbers is undefined, it's not a big problem.

  • Custom User Avatar

    Yep.

    But it's up to the kata solver to decide if they want to handle inputs not accounted for in the test fixture. Everyone has a different goal here, but I've found that people tend to write only what is needed to pass the tests.

    If we took every possible scenario into consideration on every kata, this place would be unnecessarily verbose.