E4138

E4138#

Range operators only support builtin integer types, they cannot be used on this type.

Erroneous example#

For example, you cannot use Float nor Double with range operators.

fn main {
  for _ in 0.0..<1.0 {
    ()
  }
}

Suggestion#

Use integer types for the range operators, and generate floats from these integers instead:

fn main {
  for i in 0..<10 {
    println(Float::from_int(i))
  }
}

You can also use until to construct a range of numbers:

pub fn print_range() -> Unit {
  let range : Iter[Int] = (0).until(10)
  for i in range {
    println(Float::from_int(i))
  }
}