PageRenderTime 43ms CodeModel.GetById 34ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 1ms

/src/test/run-pass/iter-range.rs

http://github.com/jruderman/rust
Rust | 13 lines | 10 code | 3 blank | 0 comment | 1 complexity | 084342ecfc89370fc69205a98cce33d4 MD5 | raw file
 1
 2
 3fn range(a: int, b: int, it: fn(int)) {
 4    assert (a < b);
 5    let mut i: int = a;
 6    while i < b { it(i); i += 1; }
 7}
 8
 9fn main() {
10    let mut sum: int = 0;
11    range(0, 100, |x| sum += x );
12    log(debug, sum);
13}