Project

General

Profile

Bug #9810 ยป 0001-Update-documentation-on-Numeric-step.patch

dpulliam (Dylan Pulliam), 02/09/2016 05:29 PM

View differences:

numeric.c
2157 2157
 *
2158 2158
 *	n = (limit - num)/step
2159 2159
 *
2160
 *  If any of the arguments are strings, an ArgumentError or TypeError will be thrown. See the following examples to know when each error will be thrown.
2161
 *
2162
 *  String as the last argument:
2163
 *      irb(main):001:0> 1.1.step(5.1, "1") {} #=> ArgumentError: comparison of String with 0 failed
2164
 *  String as the first argument:
2165
 *      irb(main):002:0> 1.1.step("5.1", 1) {} #=> TypeError: no implicit conversion to float from string
2166
 *
2160 2167
 *  Otherwise, the loop starts at +num+, uses either the less-than (<) or
2161 2168
 *  greater-than (>) operator to compare the counter against +limit+, and
2162 2169
 *  increments itself using the <code>+</code> operator.
2163
-