You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
388 B
20 lines
388 B
use std::io::stdin; |
|
|
|
const fn double(x: i32) -> i32 { |
|
x * 2 |
|
} |
|
|
|
const FIVE: i32 = 5; |
|
const TEN: i32 = double(FIVE); |
|
|
|
fn main() { |
|
assert_eq!(5, FIVE); |
|
assert_eq!(10, double(FIVE)); |
|
|
|
println!("Your const is {}", double(10)); |
|
|
|
let mut s = String::new(); |
|
stdin().read_line(&mut s).unwrap(); |
|
|
|
println!("Your double: {}", double(s.trim().parse::<i32>().unwrap())); |
|
}
|
|
|