Posted By

meanmarcus on 06/17/09


Tagged

loop recursion alphabet


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

webstic
Priestd09


Generate and recurse through the alphabet


 / Published in: Ruby
 

Just an easy way to loop through and generate the alphabet in Ruby

  1. puts ("a".."z").to_a
  2.  
  3. #=> [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z]
  4.  
  5. ("a".."z").each{|letter| puts letter}

Report this snippet  

You need to login to post a comment.