⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.93
Server IP:
65.108.141.171
Server:
Linux server.heloix.com 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
7.4.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
ri
/
2.7.0
/
system
/
Numeric
/
View File Name :
step-i.ri
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::BlankLine o; ; [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"7negative), where +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"J(i.e. <code>num.step(limit, 0)</code>) 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"KIf any of the arguments are floating point numbers, all are converted ;TI")to floats, and the loop is executed ;TI"3<i>floor(n + n*Float::EPSILON) + 1</i> times, ;TI")where <i>n = (limit - num)/step</i>.;T@o; ; [ I":Otherwise, the loop starts at +num+, uses either the ;TI"Jless-than (<code><</code>) or greater-than (<code>></code>) operator ;TI"-to compare the counter against +limit+, ;TI"=and increments itself using the <code>+</code> operator.;T@o; ; [I">If no block is given, an Enumerator is returned instead. ;TI"EEspecially, the enumerator is an Enumerator::ArithmeticSequence ;TI"Hif both +limit+ and +step+ are kind of Numeric or <code>nil</code>.;T@o; ; [I"For example:;T@o:RDoc::Markup::Verbatim; [ 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:@format0o; ; [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";2.718281828459045 2.9182818284590453 3.118281828459045;T; 0: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"znum.step(by: step, to: limit) {|i| block } -> self num.step(by: step, to: limit) -> an_enumerator num.step(by: step, to: limit) -> an_arithmetic_sequence num.step(limit=nil, step=1) {|i| block } -> self num.step(limit=nil, step=1) -> an_enumerator num.step(limit=nil, step=1) -> an_arithmetic_sequence ;T0[ I"(*args);T@EFI"Numeric;TcRDoc::NormalClass00