]> git.lizzy.rs Git - rust.git/blob - tests/ui/fact.rs
Rollup merge of #107482 - notriddle:notriddle/keywords, r=jsha
[rust.git] / tests / ui / fact.rs
1 // run-pass
2
3 fn f(x: isize) -> isize {
4     // println!("in f:");
5
6     println!("{}", x);
7     if x == 1 {
8         // println!("bottoming out");
9
10         return 1;
11     } else {
12         // println!("recurring");
13
14         let y: isize = x * f(x - 1);
15         // println!("returned");
16
17         println!("{}", y);
18         return y;
19     }
20 }
21
22 pub fn main() {
23     assert_eq!(f(5), 120);
24     // println!("all done");
25
26 }