Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
p.151 Remove Assignments to Parameters; return "result" instead of "i…
…nput_val".
  • Loading branch information
kono committed May 29, 2010
1 parent 811e567 commit aa37959
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions chapter6/Remove_Assignments_to_Parameters.rb
@@ -1,7 +1,8 @@

def discount(input_val, quantity, year_to_date)
input_val -= 2 if input_val > 50
input_val -= 1 if quantity > 100
input_val -= 4 if year_to_date > 10000
input_val
result = input_val
result -= 2 if input_val > 50
result -= 1 if quantity > 100
result -= 4 if year_to_date > 10000
result
end

0 comments on commit aa37959

Please sign in to comment.