D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Array
/
Filename :
take_while-i.ri
back
Copy
U:RDoc::AnyMethod[iI"take_while:ETI"Array#take_while;TF:publico:RDoc::Markup::Document:@parts[ o:RDoc::Markup::Paragraph; [I"QWith a block given, calls the block with each successive element of +self+; ;TI"<stops iterating if the block returns +false+ or +nil+; ;TI"_returns a new array containing those elements for which the block returned a truthy value:;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [ I"a = [0, 1, 2, 3, 4, 5] ;TI":a.take_while {|element| element < 3 } # => [0, 1, 2] ;TI"Ca.take_while {|element| true } # => [0, 1, 2, 3, 4, 5] ;TI"3a.take_while {|element| false } # => [] ;T:@format0o; ; [I"3With no block given, returns a new Enumerator.;T@o; ; [I"Does not modify +self+.;T@o; ; [I"NRelated: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].;T: @fileI"array.c;T:0@omit_headings_from_table_of_contents_below0I"Ktake_while {|element| ... } -> new_array take_while -> new_enumerator ;T0[ I"();T@ FI" Array;TcRDoc::NormalClass00