diff --git a/rustbyexample/custom_types/custom_types_constants.rs b/rustbyexample/custom_types/custom_types_constants.rs new file mode 100644 index 0000000..85e6426 --- /dev/null +++ b/rustbyexample/custom_types/custom_types_constants.rs @@ -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; +}