class Range[E: Discrete]
super Collection[E]
- redef var first: E
+ redef var first
# Get the last element.
var last: E
end
redef class Int
- # Returns the range from 0 to `self-1`, is used to do:
+ # Returns the range from 0 to `self-1`.
#
- # var s = new Array[String]
- # for i in 3.times do s.add "cool"
- # assert s.join(" ") == "cool cool cool"
+ # assert 3.times == [0..3[
+ # assert 10.times == [0..10[
+ # assert ((-1).times).is_empty
#
- # s.clear
- # for i in 10.times do s.add(i.to_s)
- # assert s.to_s == "0123456789"
+ # This can be usefull for loops:
+ #
+ # var s = new Array[String]
+ # for i in 3.times do s.add "cool"
+ # assert s.join(" ") == "cool cool cool"
fun times: Range[Int] do return [0 .. self[
end