Advertisement
Guest User

Untitled

a guest
Nov 24th, 2013
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. numbers_array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  2. ###ПОЧЕМУ, ЕСЛИ МЕТОД, ОБРАЩЕННЫЙ В PROC (СНИЗУ) ПРЕВРАЩАЕТ ЦЕЛЫЕ В СТРОКИ ВНУТРИ МАССИВА, ТО
  3. strings_array = numbers_array.collect(&:to_s)
  4. ###=>["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]
  5.  
  6. numbers_array_2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  7. ###ТО ПРОСТОЙ БЛОК, ПРЕВАЩАЮЩИЙ КАЖДЫЙ ЭЛЕМЕНТ МАССИВА В СТРОКУ
  8. strings_array_2 = numbers_array_2.each { |x| x = x.to_s }
  9. ###=>[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  10. ###НЕ ДАЕТ НИЧЕГО?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement