D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Enumerable
/
Filename :
first-i.ri
back
Copy
U:RDoc::AnyMethod[iI" first:ETI"Enumerable#first;TF:publico:RDoc::Markup::Document:@parts[ o:RDoc::Markup::Paragraph; [I"+Returns the first element or elements.;To:RDoc::Markup::BlankLine o; ; [I"LWith no argument, returns the first element, or +nil+ if there is none:;T@o:RDoc::Markup::Verbatim; [ I"+(1..4).first # => 1 ;TI"-%w[a b c].first # => "a" ;TI"3{foo: 1, bar: 1, baz: 2}.first # => [:foo, 1] ;TI"-[].first # => nil ;T:@format0o; ; [I"1With integer argument +n+, returns an array ;TI"2containing the first +n+ elements that exist:;T@o;; [ I"3(1..4).first(2) # => [1, 2] ;TI"<%w[a b c d].first(3) # => ["a", "b", "c"] ;TI"A%w[a b c d].first(50) # => ["a", "b", "c", "d"] ;TI"C{foo: 1, bar: 1, baz: 2}.first(2) # => [[:foo, 1], [:bar, 1]] ;TI".[].first(2) # => [];T; 0: @fileI"enum.c;T:0@omit_headings_from_table_of_contents_below0I"2first -> element or nil first(n) -> array ;T0[ I"(*args);T@#FI"Enumerable;TcRDoc::NormalModule00