Update excercise5.rb

made it a method