Skip to content

Commit ae31c15

Browse files
committed
moved renamed docs formatted | complex.rs
1 parent 9f0e5d9 commit ae31c15

File tree

2 files changed

+45
-38
lines changed

2 files changed

+45
-38
lines changed

tests/ui/complex.rs

Lines changed: 0 additions & 38 deletions
This file was deleted.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//! Basic control flow test including recursion, loops, function calls,
2+
//! and side-effect functions to verify general correctness and runtime behavior.
3+
4+
//@ run-pass
5+
6+
type Int = isize;
7+
8+
fn putstr(_s: String) {}
9+
10+
fn putint(i: isize) {
11+
let mut n = i;
12+
while n < i + 3 {
13+
putstr("hi".to_string());
14+
n += 1;
15+
}
16+
}
17+
18+
fn foo(x: isize) -> isize {
19+
let mut y: Int = x + 2;
20+
putstr("hello".to_string());
21+
22+
while y < 10 {
23+
putint(y);
24+
if y * 3 == 4 {
25+
y += 2;
26+
// previously called nothing()
27+
}
28+
}
29+
30+
let z: Int = 0x55;
31+
32+
if x > 1000 {
33+
return 0; // base case to avoid stack overflow
34+
}
35+
36+
foo(z);
37+
0
38+
}
39+
40+
fn main() {
41+
let x = 2 + 2;
42+
println!("{}", x);
43+
println!("hello, world");
44+
println!("{}", 10);
45+
}

0 commit comments

Comments
 (0)