diff options
| author | mo8it <mo8it@proton.me> | 2024-06-08 21:35:44 +0200 |
|---|---|---|
| committer | mo8it <mo8it@proton.me> | 2024-06-08 21:35:44 +0200 |
| commit | e1051724c3f8d9dc3d25bcb854e0c4ac7ff3b2b6 (patch) | |
| tree | 806b269a4a86650c8ace18e799e6ad19f7049055 /solutions | |
| parent | 0e4136d31e9aff282532b1a85cf40013bfba3f27 (diff) | |
primitive_types2 solution
Diffstat (limited to 'solutions')
| -rw-r--r-- | solutions/04_primitive_types/primitive_types2.rs | 22 |
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!"); + } +} |
