#sample solution
fruits = ["orange", "apple", "banana", "pear", "grapes"]
#fruits.sort!.reverse! would have been simpler
fruits.sort! {|firstfruit,secondfruit| secondfruit<=>firstfruit}
fruits = ["orange", "apple", "banana", "pear", "grapes"]
#fruits.sort!.reverse! would have been simpler
fruits.sort! {|firstfruit,secondfruit| secondfruit<=>firstfruit}
No comments:
Post a Comment