Ad
  • Custom User Avatar

    The parentheses are not necessary, as you do the modulo first already.

  • Custom User Avatar

    Hey Farid,

    Thanks for your comment. I actually didn't forget the validation but intentionally left it out. As you correctly quoted the description, the goal was to write a function that "takes a non-negative integer." This implies that the argument cannot be negative. You may also have noticed that my implementation doesn't handle values greater than 359999, and it's for the same reason. The assignment says, "The maximum time never exceeds 359999." The author of this kata also didn't specify expected behavior for those cases, nor did they provide tests.

    Having said all that, I agree that this code isn't production ready without the validation. But if it were up to me, I'd ensure that no invalid values can be passed (e.g., via static analysis or a dedicated value object) to eliminate the need for validation in this function altogether.

  • Custom User Avatar

    Thanks for your smart approach, but you forget validation about Negative int!
    Write a function, which takes a non-negative integer (seconds)...

  • Custom User Avatar

    Always be carefull when using empty() . As stated here(https://www.php.net/manual/en/function.empty) the values below will return "TRUE"

    • 0 (0 as an integer)
    • 0.0 (0 as a float)
    • "0" (0 as a string)
  • Custom User Avatar

    Well, if I got you right I'd say that this metadata doesn't belong to the version. It sounds more like we're talking about a Release that consists of a Version and maybe some Metadata or even more specific objects.

  • Custom User Avatar

    In version object we can load some meta-data and when we up version by creating new object we must hand over this data for new object for close losing meta-data in new wersion.

    It`s not important for solution on codewars. I`,m just trying talking with good programmer like u <3 about this.

  • Custom User Avatar

    Thanks for your comment. Can you elaborate on why you think creating a new object for each version is a bad idea?

  • Custom User Avatar

    Good idea with version class. But allways create new object with next version it`s a bad idea if we look in feature. Varsion can make some properties like 'path to artifacts', etc and best way will be increment integers in current object.

  • Custom User Avatar

    I just added the missing $ to the argument of each function plus some type hints.
    Not sure why the tests are failing now.

  • Custom User Avatar

    Yes, sorry. I mixed up "Test Cases" and "Sample Test Cases". I just forked and resubmitted.

  • Custom User Avatar

    Thanks. Rejecting this version since there is only one test cases. Needs multiple test cases, including some random. You can fork and resubmit.

  • Custom User Avatar
  • Custom User Avatar

    Thanks. I'll try that

  • Custom User Avatar

    Every user with enough honor (I don't remember, how much exactly) can do that. You may ask on gitter, if anyone would like to review your translation: https://gitter.im/Codewars/codewars.com/kata-authoring-help

  • Custom User Avatar

    So, how does the approval process work?
    Can only the author of the kata approve my translation? 🤔

  • Loading more items...