Ruby Control Structures Hackerrank Solution