summaryrefslogtreecommitdiff
path: root/solutions
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-06-08 21:35:44 +0200
committermo8it <mo8it@proton.me>2024-06-08 21:35:44 +0200
commite1051724c3f8d9dc3d25bcb854e0c4ac7ff3b2b6 (patch)
tree806b269a4a86650c8ace18e799e6ad19f7049055 /solutions
parent0e4136d31e9aff282532b1a85cf40013bfba3f27 (diff)
primitive_types2 solution
Diffstat (limited to 'solutions')
-rw-r--r--solutions/04_primitive_types/primitive_types2.rs22
1 files changed, 21 insertions, 1 deletions
diff --git a/solutions/04_primitive_types/primitive_types2.rs b/solutions/04_primitive_types/primitive_types2.rs
index 4e18198..eecc680 100644
--- a/solutions/04_primitive_types/primitive_types2.rs
+++ b/solutions/04_primitive_types/primitive_types2.rs
@@ -1 +1,21 @@
-// Solutions will be available before the stable release. Thank you for testing the beta version 🥰
+fn main() {
+ let my_first_initial = 'C';
+ if my_first_initial.is_alphabetic() {
+ println!("Alphabetical!");
+ } else if my_first_initial.is_numeric() {
+ println!("Numerical!");
+ } else {
+ println!("Neither alphabetic nor numeric!");
+ }
+
+ // Example with an emoji.
+ let your_character = '🦀';
+
+ if your_character.is_alphabetic() {
+ println!("Alphabetical!");
+ } else if your_character.is_numeric() {
+ println!("Numerical!");
+ } else {
+ println!("Neither alphabetic nor numeric!");
+ }
+}