U:RDoc::AnyMethod[iI" step:ETI"Numeric#step;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"MInvokes the given block with the sequence of numbers starting at +num+, ;TI";incremented by +step+ (defaulted to +1+) on each call.;To:RDoc::Markup::BlankLineo; ; [I"PThe loop finishes when the value to be passed to the block is greater than ;TI"H+limit+ (if +step+ is positive) or less than +limit+ (if +step+ is ;TI"limit is defaulted to infinity.;T@o; ; [ I"BIn the recommended keyword argument style, either or both of ;TI"C+step+ and +limit+ (default infinity) can be omitted. In the ;TI"3fixed position argument style, zero as a step ;TI"=(i.e. num.step(limit, 0)) is not allowed for historical ;TI"compatibility reasons.;T@o; ; [I"KIf all the arguments are integers, the loop operates using an integer ;TI" counter.;T@o; ; [I"ƒIf any of the arguments are floating point numbers, all are converted to floats, and the loop is executed the following expression:;T@o:RDoc::Markup::Verbatim; [I"floor(n + n*epsilon)+ 1 ;T: @format0o; ; [I"$Where the +n+ is the following:;T@o; ; [I"n = (limit - num)/step ;T; 0o; ; [I"KOtherwise, the loop starts at +num+, uses either the less-than (<) or ;TI"Kgreater-than (>) operator to compare the counter against +limit+, and ;TI"9increments itself using the + operator.;T@o; ; [I"=If no block is given, an Enumerator is returned instead.;T@o; ; [I"For example:;T@o; ; [ I"p 1.step.take(4) ;TI"p 10.step(by: -1).take(4) ;TI"(3.step(to: 5) { |i| print i, " " } ;TI"(1.step(10, 2) { |i| print i, " " } ;TI">Math::E.step(to: Math::PI, by: 0.2) { |f| print f, " " } ;T; 0o; ; [I"Will produce:;T@o; ; [ I"[1, 2, 3, 4] ;TI"[10, 9, 8, 7] ;TI" 3 4 5 ;TI"1 3 5 7 9 ;TI"72.71828182845905 2.91828182845905 3.11828182845905;T; 0: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"ênum.step(by: step, to: limit) {|i| block } -> self num.step(by: step, to: limit) -> an_enumerator num.step(limit=nil, step=1) {|i| block } -> self num.step(limit=nil, step=1) -> an_enumerator ;T0[I" (*args);T@HFI" Numeric;TcRDoc::NormalClass00