This commit is contained in:
Enrico Bozzolini 2020-05-29 22:09:22 +02:00
commit ec782274a1
6 changed files with 13 additions and 11 deletions

View File

@ -34,7 +34,7 @@ This will install Rustlings and give you access to the `rustlings` command. Run
## Windows
First, set `ExecutionPolicy` to `RemoteSigned`:
In PowerShell, set `ExecutionPolicy` to `RemoteSigned`:
```ps
Set-ExecutionPolicy RemoteSigned

View File

@ -1,10 +1,11 @@
// An imaginary magical school has a new report card generation system written in rust!
// An imaginary magical school has a new report card generation system written in Rust!
// Currently the system only supports creating report cards where the student's grade
// is represented numerically (e.g. 1.0 -> 5.5). However, the school also issues alphabetical grades
// (A+ -> F-) and needs to be able to print both types of report card!
// is represented numerically (e.g. 1.0 -> 5.5).
// However, the school also issues alphabetical grades (A+ -> F-) and needs
// to be able to print both types of report card!
// Make the necessary code changes to support alphabetical report cards, thereby making the second
// test pass.
// Make the necessary code changes to support alphabetical report cards, thereby making
// the second test pass.
// I AM NOT DONE
pub struct ReportCard {
@ -15,7 +16,8 @@ pub struct ReportCard {
impl ReportCard {
pub fn print(&self) -> String {
format!("{} ({}) - achieved a grade of {}", &self.student_name, &self.student_age, &self.grade)
format!("{} ({}) - achieved a grade of {}",
&self.student_name, &self.student_age, &self.grade)
}
}

View File

@ -15,7 +15,7 @@ fn main() {
];
for iter in 0..5 {
let number_to_add: u16 = {
((iter * 5) + 2) / (4 * 16)
((iter * 1235) + 2) / (4 * 16)
};
numbers[iter as usize] = Option::Some(number_to_add);

View File

@ -4,6 +4,6 @@
fn main() {
let mut x = 3;
println!("Number {}", x);
x = 5;
x = 5; // don't change this line
println!("Number {}", x);
}

View File

@ -2,7 +2,7 @@
// Make me compile! Execute the command `rustlings hint variables5` if you want a hint :)
fn main() {
let number = "3";
let number = "3"; // don't change this line
println!("Number {}", number);
let number = 3;
println!("Number {}", number);

View File

@ -68,7 +68,7 @@ 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
https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html#differences-between-variables-and-constants
"""
# IF