RBE custom types constants
This commit is contained in:
parent
f40981544c
commit
278ec88944
16
rustbyexample/custom_types/custom_types_constants.rs
Normal file
16
rustbyexample/custom_types/custom_types_constants.rs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
static LANGUAGE: &str = "Rust";
|
||||||
|
const THRESHOLD: i32 = 10;
|
||||||
|
|
||||||
|
fn is_big(n: i32) -> bool {
|
||||||
|
n > THRESHOLD
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let n = 16;
|
||||||
|
|
||||||
|
println!("This is {}", LANGUAGE);
|
||||||
|
println!("The threshold is {}", THRESHOLD);
|
||||||
|
println!("{} is {}", n, if is_big(n) { "big" } else { "small" });
|
||||||
|
|
||||||
|
// THRESHOLD = 5;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user