mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-22 05:52:23 -05:00
feat: Add exercise variables6 covering const (#352)
This commit is contained in:
parent
59f56b24d9
commit
5999acd24a
2 changed files with 24 additions and 0 deletions
9
exercises/variables/variables6.rs
Normal file
9
exercises/variables/variables6.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
// variables5.rs
|
||||
// Make me compile! Execute the command `rustlings hint variables6` if you want a hint :)
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
const NUMBER = 3;
|
||||
fn main() {
|
||||
println!("Number {}", NUMBER);
|
||||
}
|
15
info.toml
15
info.toml
|
@ -56,6 +56,21 @@ You can read more about 'Shadowing' in the book's section 'Variables and Mutabil
|
|||
https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html#shadowing
|
||||
Try to solve this exercise afterwards using this technique."""
|
||||
|
||||
[[exercises]]
|
||||
name = "variables6"
|
||||
path = "exercises/variables/variables6.rs"
|
||||
mode = "compile"
|
||||
hint = """
|
||||
We know about variables and mutability, but there is another important type of
|
||||
variable available; constants.
|
||||
Constants are always immutable and they are declared with keyword 'const' rather
|
||||
then keyword 'let'.
|
||||
Constants types must also always be annotated.
|
||||
|
||||
Read more about constants under 'Differences Between Variables and Constants' in the book's section 'Variables and Mutability':
|
||||
https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html
|
||||
"""
|
||||
|
||||
# IF
|
||||
|
||||
[[exercises]]
|
||||
|
|
Loading…
Reference in a new issue