Is it adding a 1 to the actual product of multiplication on each iteration? What if the product ends with 9?
More summarized than my code, good job! I liked the way you expressed it
Why prev? Wouldn't that imply the first argument is the previous item of the array? I like acc (for accumulator) and v or e (value or element) or something. (Although I'm guilty of using a and b for a quick one)
I would say this is best practice since it is easier to read and understand.
The if solution is more likely to be written wrong or get misunderstood.
The note about -0 that used to be in the kata description was written only with C# in mind. I reworded the note to make it sound less like a requirement last year.
This comment is hidden because it contains spoiler information about the solution
Ah, that's how you make it DRYer, thanks for this!
yes, it clearly does not matter in this kata
Context is important. In this context, only one variable was necessary. If two variables were necessary it'd make sense to leave them as two separate variables, and in that context I am sure most would make the appropriate decision that provides the best solution to optimize their performance, completeness, and simplicity of their codebase
while it clearly does not matter in this kata, the "why not" may come into play where one should consider whether the a and b in the original setup are potentially required somewhere else in the code landscape. eliminating them may turn out to be disasterous. this is pure supposition, but perhaps worth consideration
whats cheatin about it
lol the kata did say it was supposed to store "codewa.rs"
Good for returning after a Boolean value is passed, but will also return for things that evaluate as true or false. At any level higher than 8, I'd suggest the test should probably be written to reject this solution, but it definitely fulfills the test criteria.