summaryrefslogtreecommitdiff
path: root/exercises/23_conversions/using_as.rs
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-07-05 13:39:50 +0200
committermo8it <mo8it@proton.me>2024-07-05 13:39:50 +0200
commit7123c7ae3a9605fbe962e4ef0a0f1424cd16fef8 (patch)
treec67f7e62bb9a179ae4fdbab492501cb6847e64c7 /exercises/23_conversions/using_as.rs
parent77b687d501771c24bd83294d97b8e6f9ffa92d6b (diff)
parent4d9c346a173bb722b929f3ea3c00f84954483e24 (diff)
Merge remote-tracking branch 'upstream/main' into fix-enum-variant-inconsistency
Diffstat (limited to 'exercises/23_conversions/using_as.rs')
-rw-r--r--exercises/23_conversions/using_as.rs17
1 files changed, 4 insertions, 13 deletions
diff --git a/exercises/23_conversions/using_as.rs b/exercises/23_conversions/using_as.rs
index 414cef3..c131d1f 100644
--- a/exercises/23_conversions/using_as.rs
+++ b/exercises/23_conversions/using_as.rs
@@ -1,19 +1,10 @@
-// using_as.rs
-//
-// Type casting in Rust is done via the usage of the `as` operator. Please note
-// that the `as` operator is not only used when type casting. It also helps with
-// renaming imports.
-//
-// The goal is to make sure that the division does not fail to compile and
-// returns the proper type.
-//
-// Execute `rustlings hint using_as` or use the `hint` watch subcommand for a
-// hint.
-
-// I AM NOT DONE
+// Type casting in Rust is done via the usage of the `as` operator.
+// Note that the `as` operator is not only used when type casting. It also helps
+// with renaming imports.
fn average(values: &[f64]) -> f64 {
let total = values.iter().sum::<f64>();
+ // TODO: Make a conversion before dividing.
total / values.len()
}