D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Array
/
Filename :
first-i.ri
back
Copy
U:RDoc::AnyMethod[iI" first:ETI"Array#first;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"DReturns elements from +self+, or +nil+; does not modify +self+.;To:RDoc::Markup::BlankLine o; ; [I"FWith no argument given, returns the first element (if available):;T@o:RDoc::Markup::Verbatim; [I"a = [:foo, 'bar', 2] ;TI"a.first # => :foo ;TI"a # => [:foo, "bar", 2] ;T:@format0o; ; [I"'If +self+ is empty, returns +nil+.;T@o;; [I"[].first # => nil ;T; 0o; ; [I"9With a non-negative integer argument +count+ given, ;TI"Freturns the first +count+ elements (as available) in a new array:;T@o;; [I"a.first(0) # => [] ;TI"$a.first(2) # => [:foo, "bar"] ;TI"'a.first(50) # => [:foo, "bar", 2] ;T; 0o; ; [I"NRelated: see {Methods for Querying}[rdoc-ref:Array@Methods+for+Querying].;T: @fileI" array.rb;T:0@omit_headings_from_table_of_contents_below0I"6first -> object or nil first(count) -> new_array ;T0[ I"(n = unspecified = true);T@)FI" Array;TcRDoc::NormalClass00