cjcjameson / phase_0_unit_2

Phase 0 Unit 2 Curriculum
0 stars 0 forks source link

Credit Card Validator #2

Open hilarybarr opened 10 years ago

hilarybarr commented 10 years ago

Hi CJ,

Your solution to the Credit Card Validator challenge is a bit different from the others I’ve seen, and I like it! It’s interesting how you use a .each_with_index iterator to multiply even indexes by two and to add each index to the luhn_sum. That makes your code efficient and DRY.

It’s also great that you incorporate some rspec-like syntax in your driver test code.

Remember that check_card should return true if @total_sum%10== and false if @total_sum%10 !=0.

cjcjameson commented 10 years ago

Hi Hilary, thanks for checking it out! I was happy to use EwI here.

I think my last line return luhn_sum % 10 == 0 does both, right?

What else are you working on? C.J.