rust/test/loops.rs

16 lines
236 B
Rust
Raw Normal View History

2016-03-12 21:32:24 -06:00
#![feature(custom_attribute)]
#![allow(dead_code, unused_attributes)]
2016-03-13 09:31:29 -05:00
#[miri_run]
fn factorial_loop() -> i64 {
let mut product = 1;
let mut i = 1;
2016-03-12 21:32:24 -06:00
2016-03-13 09:31:29 -05:00
while i <= 10 {
product *= i;
i += 1;
}
2016-03-12 21:32:24 -06:00
2016-03-13 09:31:29 -05:00
product
}