mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
14 lines
265 B
Rust
14 lines
265 B
Rust
// run-pass
|
|
|
|
fn that_odd_parse(c: bool, n: usize) -> u32 {
|
|
let x = 2;
|
|
let a = [1, 2, 3, 4];
|
|
let b = [5, 6, 7, 7];
|
|
x + if c { a } else { b }[n]
|
|
}
|
|
|
|
fn main() {
|
|
assert_eq!(4, that_odd_parse(true, 1));
|
|
assert_eq!(8, that_odd_parse(false, 1));
|
|
}
|