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