Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Yes, I understand - but why it no passed in attempt ??
see log report - I print out all arrays and do not understand why expected false at first case (only one "true" and it realy true) and in second case, where no one "true", but it say equal "true"
ps. it is in golang
the test button is just example tests, the attempt button is the full test suite.
there's nothing weird about passing some tests but not others. that's not an issue.
GO:
tests passed, attempt - no
why??
Click to expand
Click to expand
@rowcased Thanks, I solved it using try-catch block.
@natan Thanks for suggestions.
@natan I'm not sure how it would be, other that my comment was a bit vauge. Getting that exception means
null
is present and the user has attempted an action onnull
that's not allowed. So, they have to track that down. Knowing that the parameter is anarray
narrows the search... well, it's tuens out it's the input, hence the unexpected exception. I already knew the 4th test hadnull
. In any case, the OP has solved it, possibly from my hinting, I suppose. (FYI the exception did not provide a line number)your nested conditions are difficult to track and will hurt any reasoning you do about the rest of the code. you can write those conditions as early exits instead, without nesting the rest - thereby keeping it sequential:
you've done some printing which is good but maybe you're not printing the relevant pieces of information. if you write out step by step what the program is doing then you can tell from the output where it's going wrong.
looks like you've since found the bug - you would see through printing that you had very small differences between the values that you compared, this is because floats are typically approximations, and it's incorrect to test wether two approximations are exactly equal
another thing is to avoid the word "wrong" and instead describe the problem in terms of what happened differently from the desired outcome.
try it and find out
@rowcased I feel like that's a bit misleading considering the arguments involved here. not sure if you've looked at test4 for C# but I know I'd be confused by what you wrote
@BrandoL keep in mind that you can print from within your solution. also consider carefully the error message and maybe you have a line number/location for it as well which might tell you a lot about what's happening. reading the instructions may also help since this situation is mentioned there.
Hi, Ema! I don't know if it's actual for you. But try to read the description more carefully. Parameters of function can be null and not only array.
So, first of all you need to check if any of given parameter is null.
the error message is telling you something.
ergo
I can't pass 4. test.
System.ArgumentNullException : Value cannot be null. (Parameter 'array')
May you tell numbers for 4. test?