rust/src/test/codegen/iterate-over-array.rs

11 lines
154 B
Rust
Raw Normal View History

2013-07-16 17:42:28 -07:00
#[no_mangle]
fn test(x: &[int]) -> int {
let mut y = 0;
let mut i = 0;
while (i < x.len()) {
y += x[i];
i += 1;
}
y
}