summaryrefslogtreecommitdiff
path: root/exercises/functions/functions5.rs
diff options
context:
space:
mode:
authormarisa <mokou@posteo.de>2019-11-11 16:51:38 +0100
committermarisa <mokou@posteo.de>2019-11-11 16:51:38 +0100
commit9bdb0a12e45a8e9f9f6a4bd4a9c172c5376c7f60 (patch)
tree3c4a094d57ecedf9706e0ba567a9f157590177c8 /exercises/functions/functions5.rs
parent627cdc07d07dfe6a740e885e0ddf6900e7ec336b (diff)
feat: Refactor hint system
Hints are now accessible using the CLI subcommand `rustlings hint <exercise name`. BREAKING CHANGE: This fundamentally changes the way people interact with exercises.
Diffstat (limited to 'exercises/functions/functions5.rs')
-rw-r--r--exercises/functions/functions5.rs38
1 files changed, 1 insertions, 37 deletions
diff --git a/exercises/functions/functions5.rs b/exercises/functions/functions5.rs
index d9227c9..c7841a6 100644
--- a/exercises/functions/functions5.rs
+++ b/exercises/functions/functions5.rs
@@ -1,5 +1,5 @@
// functions5.rs
-// Make me compile! Scroll down for hints :)
+// Make me compile! Execute `rustlings hint functions5` for hints :)
fn main() {
let answer = square(3);
@@ -9,39 +9,3 @@ fn main() {
fn square(num: i32) -> i32 {
num * num;
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-// This is a really common error that can be fixed by removing one character.
-// It happens because Rust distinguishes between expressions and statements: expressions return
-// a value based on its operand, and statements simply return a () type which behaves just like `void` in C/C++ language.
-// We want to return a value of `i32` type from the `square` function, but it is returning a `()` type...
-// They are not the same. There are two solutions:
-// 1. Add a `return` ahead of `num * num;`
-// 2. remove `;`, make it to be `num * num`