Ad
  • Default User Avatar

    Misleading instructions, in a couple of places:


    "You get an array of arrays."

    One of the test inputs is an empty array, [], another is the value null, and others are arrays that contain the value null in place of one or more arrays. This makes your very first statement incorrect; the first two of these specific examples are not arrays of arrays, and you could easily argue that the thirs example is not either. (Is a mixed array of arrays and numbers an "array of arrays"? I don't think so. Likewise, I do not think a mixed array of arrays and null values is an "array of arrays".) You could dramatically improve the instructions for this kata by modifying this first sentence: "The input to the function may be null, or may be an array. If the input is an array, it may be empty, or may contain null values and/or one or more arrays."


    "When an array in the array is null or empty, the method should return 0 too!"

    So "when an array...is null", the method should return 0.

    An array cannot be null. It can contain null (or even multiple nulls), but it cannot be null. I think many of the questions asked in this thread relate to this misleading clause. You could correct this by modifying the misleading clause:

    "When a component array in the array is empty, or when the component is the value null, the method should return 0 too!"