-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
14 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
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_SIZE` with a value of `100`. | ||
- Ensure that `MAX_SIZE` has the type `i32`. | ||
- Return the value of `MAX_SIZE` from the `main` function. | ||
|
||
## Hints | ||
|
||
- Use the `const` keyword to define the constant. | ||
- Ensure you **specify the type** of the constant explicitly. |