saasbook

each_with_index_1.rb

Jan 9th, 2013
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.17 KB | None | 0 0
  1. %w(alice bob carol).each_with_custom_index(3,2) do |person,index|
  2.   puts ">> #{person} is number #{index}"
  3. end
  4. >> alice is number 3
  5. >> bob is number 5
  6. >> carol is number 7
Add Comment
Please, Sign In to add comment