Range class offers a simple way to convert a range into an array with to_a. : Convert to Array « Range « Ruby






Range class offers a simple way to convert a range into an array with to_a.



('A'..'Z').to_a.each { |letter| print letter }

 

Related examples in the same category

1.Convert range to array