D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Array
/
Filename :
shift-i.ri
back
Copy
U:RDoc::AnyMethod[iI" shift:ETI"Array#shift;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"6Removes and returns leading elements from +self+.;To:RDoc::Markup::BlankLine o; ; [I"FWith no argument, removes and returns one element, if available, ;TI"or +nil+ otherwise:;T@o:RDoc::Markup::Verbatim; [ I"a = [0, 1, 2, 3] ;TI"a.shift # => 0 ;TI"a # => [1, 2, 3] ;TI"[].shift # => nil ;T:@format0o; ; [I"7With non-negative numeric argument +count+ given, ;TI"4removes and returns the first +count+ elements:;T@o;; [I"a = [0, 1, 2, 3] ;TI"a.shift(2) # => [0, 1] ;TI"a # => [2, 3] ;TI"a.shift(1.1) # => [2] ;TI"a # => [3] ;TI"a.shift(0) # => [] ;TI"a # => [3] ;T; 0o; ; [I"If +count+ is large, ;TI"&removes and returns all elements:;T@o;; [I"a = [0, 1, 2, 3] ;TI"#a.shift(50) # => [0, 1, 2, 3] ;TI"a # => [] ;T; 0o; ; [I"3If +self+ is empty, returns a new empty array.;T@o; ; [I"NRelated: see {Methods for Deleting}[rdoc-ref:Array@Methods+for+Deleting].;T: @fileI"array.c;T:0@omit_headings_from_table_of_contents_below0I"=shift -> object or nil shift(count) -> new_array or nil ;T0[ I"(*args);T@5FI" Array;TcRDoc::NormalClass00