lib: improves usage example of Int::times
authorAlexis Laferrière <alexis.laf@xymus.net>
Sat, 16 Nov 2013 17:31:49 +0000 (12:31 -0500)
committerAlexis Laferrière <alexis.laf@xymus.net>
Sun, 17 Nov 2013 21:22:57 +0000 (16:22 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/standard/collection/range.nit

index 3855be7..62094a4 100644 (file)
@@ -104,7 +104,12 @@ end
 redef class Int
        # Returns the range from 0 to `self-1`, is used to do:
        #
-       #    for i in 3.times do print "Cool"
-       #    for i in 100.times do print "{i}/100"
+       #    var s = new Array[String]
+       #    for i in 3.times do s.add "cool"
+       #    assert s.join(" ") == "cool cool cool"
+       #
+       #    s.clear
+       #    for i in 10.times do s.add(i.to_s)
+       #    assert s.to_s == "0123456789"
        fun times: Range[Int] do return [0 .. self[
 end