Ruby/Array/Pop
Материал из Wiki.crossplatform.ru
(Различия между версиями)
ViGOur (Обсуждение | вклад) м (1 версия: Импорт выборки материалов по Ruby) |
Текущая версия на 18:01, 13 сентября 2010
Remove entries from an array one by one.
# arrays act as a "first in, first out" system # popping is the process of retrieving items from the end of the array and removing them at the same time. x = [] x << "Word" puts x x << "Play" puts x x << "Fun" puts x puts x.pop puts x puts x.pop puts x puts x.length puts x