summaryrefslogtreecommitdiff
path: root/solutions
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-06-08 21:43:38 +0200
committermo8it <mo8it@proton.me>2024-06-08 21:43:38 +0200
commit0338b1cbdfa567d5f9580afef1d4483c7d275c32 (patch)
tree21b26766ab582facde5c19628385a6ded30acf10 /solutions
parente1051724c3f8d9dc3d25bcb854e0c4ac7ff3b2b6 (diff)
primitive_types3 solution
Diffstat (limited to 'solutions')
-rw-r--r--solutions/04_primitive_types/primitive_types3.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/solutions/04_primitive_types/primitive_types3.rs b/solutions/04_primitive_types/primitive_types3.rs
index 4e18198..8dd109f 100644
--- a/solutions/04_primitive_types/primitive_types3.rs
+++ b/solutions/04_primitive_types/primitive_types3.rs
@@ -1 +1,11 @@
-// Solutions will be available before the stable release. Thank you for testing the beta version 🥰
+fn main() {
+ // An array with 100 elements of the value 42.
+ let a = [42; 100];
+
+ if a.len() >= 100 {
+ println!("Wow, that's a big array!");
+ } else {
+ println!("Meh, I eat arrays like that for breakfast.");
+ panic!("Array not big enough, more elements needed");
+ }
+}