rust/src/test/run-pass/ret-bang.rs

12 lines
223 B
Rust
Raw Normal View History

fn my_err(s: String) -> ! { println!("{}", s); panic!(); }
2011-05-21 02:53:50 +00:00
fn okay(i: usize) -> isize {
if i == 3 {
my_err("I don't like three".to_string());
} else {
return 42;
}
2011-05-21 02:53:50 +00:00
}
pub fn main() { okay(4); }