Aaron Burgess wrote: > This is much easier and more efficient than of the suggestions on this > site. You should not have to index anything. > > letters = > 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' > character = letters.split(//) > ascii=[] > character.each do |a| > ascii << "#{a} \t #{a[0]}" > end > puts ascii > > - aaron burgess > You could also reduce the number of loops from 2xO(n) to O(n) with word="hello world!" letters=[] for i in 0...word.size # note use of 3 dots for exclusive range letters << word[i].chr end p letters =>["h", "e", "l", "l", "o", " ", "w", "o", "r", "l", "d", "!"] -- Kind Regards, Rajinder Yadav http://DevMentor.org Do Good! - Share Freely, Enrich and Empower people to Transform their lives.