summaryrefslogtreecommitdiff
path: root/range.c
diff options
context:
space:
mode:
Diffstat (limited to 'range.c')
-rw-r--r--range.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/range.c b/range.c
index 60ad3939eb..ca9052e621 100644
--- a/range.c
+++ b/range.c
@@ -319,6 +319,7 @@ discrete_object_p(VALUE obj)
/*
* call-seq:
* rng.step(n=1) {| obj | block } => rng
+ * rng.step(n=1) => an_enumerator
*
* Iterates over <i>rng</i>, passing each <i>n</i>th element to the block. If
* the range contains numbers, <i>n</i> is added for each iteration. Otherwise
@@ -326,6 +327,8 @@ discrete_object_p(VALUE obj)
* elements. The following code uses class <code>Xs</code>, which is defined
* in the class-level documentation.
*
+ * If no block is given, an enumerator is returned instead.
+ *
* range = Xs.new(1)..Xs.new(10)
* range.step(2) {|x| puts x}
* range.step(3) {|x| puts x}
@@ -453,12 +456,15 @@ sym_each_i(VALUE v, void *arg)
/*
* call-seq:
* rng.each {| i | block } => rng
+ * rng.each => an_enumerator
*
* Iterates over the elements <i>rng</i>, passing each in turn to the
* block. You can only iterate if the start object of the range
* supports the +succ+ method (which means that you can't iterate over
* ranges of +Float+ objects).
*
+ * If no block is given, an enumerator is returned instead.
+ *
* (10..15).each do |n|
* print n, ' '
* end