In Rust, constants are values that are bound to a name and are not allowed to change. Constants are always immutable and are declared using the const keyword. They must be annotated with their type, and they can be set only to a constant expression.
In this challenge, you will define and use a constant in Rust. This will help you understand how to declare constants and how they can be utilized in your programs.
Your task
- Define a constant named
MAX_SIZEwith a value of100. - Ensure that
MAX_SIZEhas the typei32. - Return the value of
MAX_SIZEfrom themainfunction. - Make sure you make the constant public using the
pubkeyword (important for the tests to pass). - Remember that constants can only be defined at the global scope. You can not define them inside a function.
Hints
- Use the
constkeyword to define the constant. - Ensure you specify the type of the constant explicitly.
// Define a constant MAX_SIZE with a value of 100.// NOTE: Define the constant outside the main function// Your code herepub fn main() -> i32 {MAX_SIZE}