I have a question about the “Ordering Your Library” lesson under “Blocks and Sorting” in the Learn Ruby course.
I’ve created the program, and I don’t get any return errors, but I don’t quite understand the “rev=false” and “if rev==true” bit.
Here’s my code:
def alphabetize(arr, rev=false)
if rev == true
numbers = [3, 8, 2, 9, 4, 1]
I understand that rev is, by default, false, and that the array “arr” will only be reversed if rev equals true. What I don’t understand is under what circumstances would rev equal true? What that would look like?