Skip to content

Commit

Permalink
Initializes index outside while loop
Browse files Browse the repository at this point in the history
  • Loading branch information
tirosh committed Feb 21, 2024
1 parent 092ecc7 commit 7336e67
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/money/money/allocation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ def self.generate(amount, parts, whole_amounts = true)

## round-robin allocation of any remaining pennies
if result.size > 0
while remaining_amount != 0
index = 0
index = 0

while remaining_amount != 0
amount_to_distribute = [1, remaining_amount.abs].min

if remaining_amount > 0
Expand Down

0 comments on commit 7336e67

Please sign in to comment.