Ruby/Array/Range Index
Материал из Wiki.crossplatform.ru
Версия от 18:01, 13 сентября 2010; ViGOur (Обсуждение | вклад)
set multiple elements at the same time
a[1..3] = ["a", "b", "c"] puts a.inspect
use ranges as array indices to select multiple elements at the same time:
a = [2, 4, 6, 8, 10, 12] puts a[1..3].inspect