From 5999acd24a4f203292be36e0fd18d385887ec481 Mon Sep 17 00:00:00 2001 From: Said Aspen Date: Tue, 14 Apr 2020 10:13:20 +0200 Subject: [PATCH] feat: Add exercise variables6 covering const (#352) --- exercises/variables/variables6.rs | 9 +++++++++ info.toml | 15 +++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 exercises/variables/variables6.rs diff --git a/exercises/variables/variables6.rs b/exercises/variables/variables6.rs new file mode 100644 index 0000000..76afa85 --- /dev/null +++ b/exercises/variables/variables6.rs @@ -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); +} diff --git a/info.toml b/info.toml index 4fbf9fd..789b612 100644 --- a/info.toml +++ b/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]]