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