Link: Ruby. Methods, Blocks, & Sorting Lesson 19

So I have been putting some code in lesson 19 on "Methods, Blocks, & Sorting." I put some code to verbose the progress so I could understand how does 'sort' method work. First, I thought whatever code that goes inside 'sort' method, this method only receives "-1, 0, or 1" for each of its iteration. With that in mind, I made a function (I called it *sort__value__desc*)to print the progress. This worked, I could see the progress. But then to add clarity, I 'upcase'-ed both item that were sent to *sort__value__desc*. In this function I only return an integer for every if. The question is: Why does the sorted strings are upcased too? Shouldn't those upcased strings are only in the function?

```
def sort_value_desc (a, b)
a.upcase!
b.upcase!
if a > b
puts "Comparing #{a} to #{b}. Result: -1"
return -1
elsif a < b
puts "Comparing #{a} to #{b}. Result: 1"
return 1
else
puts "Comparing #{a} to #{b}. Result: 0"
return 0
end
end
fruits = ["orange", "apple", "banana", "pear", "grapes"]
itr = 1
fruits.sort! do |fruit1, fruit2|
puts "Iteration #{itr}"
itr += 1
sort_value_desc(fruit1, fruit2)
end
```

And the results (see the last line in red to see what I mean):

```
Iteration 1
Comparing ORANGE to BANANA. Result: -1
Iteration 2
Comparing BANANA to GRAPES. Result: 1
Iteration 3
Comparing ORANGE to GRAPES. Result: -1
Iteration 4
Comparing APPLE to GRAPES. Result: 1
Iteration 5
Comparing PEAR to GRAPES. Result: -1
Iteration 6
Comparing APPLE to BANANA. Result: 1
Iteration 7
Comparing ORANGE to PEAR. Result: 1
["PEAR", "ORANGE", "GRAPES", "BANANA", "APPLE"]
```