Compare commits

..

3 commits

Author SHA1 Message Date
mo8it 0338b1cbdf primitive_types3 solution 2024-06-08 21:43:38 +02:00
mo8it e1051724c3 primitive_types2 solution 2024-06-08 21:35:44 +02:00
mo8it 0e4136d31e Update deps 2024-06-08 21:19:16 +02:00
8 changed files with 59 additions and 25 deletions

24
Cargo.lock generated
View file

@ -151,9 +151,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.5.4" version = "4.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" checksum = "a9689a29b593160de5bc4aacab7b5d54fb52231de70122626c178e6a368994c7"
dependencies = [ dependencies = [
"clap_builder", "clap_builder",
"clap_derive", "clap_derive",
@ -161,9 +161,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_builder" name = "clap_builder"
version = "4.5.2" version = "4.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" checksum = "2e5387378c84f6faa26890ebf9f0a92989f8873d4d380467bcd0d8d8620424df"
dependencies = [ dependencies = [
"anstream", "anstream",
"anstyle", "anstyle",
@ -173,9 +173,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_derive" name = "clap_derive"
version = "4.5.4" version = "4.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" checksum = "c780290ccf4fb26629baa7a1081e68ced113f1d3ec302fa5948f1c381ebf06c6"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro2", "proc-macro2",
@ -185,9 +185,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_lex" name = "clap_lex"
version = "0.7.0" version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70"
[[package]] [[package]]
name = "colorchoice" name = "colorchoice"
@ -886,9 +886,9 @@ checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d"
[[package]] [[package]]
name = "utf8parse" name = "utf8parse"
version = "0.2.1" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]] [[package]]
name = "version_check" name = "version_check"
@ -1093,9 +1093,9 @@ checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
[[package]] [[package]]
name = "winnow" name = "winnow"
version = "0.6.11" version = "0.6.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56c52728401e1dc672a56e81e593e912aa54c78f40246869f78359a2bf24d29d" checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]

View file

@ -47,7 +47,7 @@ include = [
[dependencies] [dependencies]
anyhow = "1.0.86" anyhow = "1.0.86"
clap = { version = "4.5.4", features = ["derive"] } clap = { version = "4.5.6", features = ["derive"] }
crossterm = "0.27.0" crossterm = "0.27.0"
hashbrown = "0.14.5" hashbrown = "0.14.5"
notify-debouncer-mini = { version = "0.4.1", default-features = false } notify-debouncer-mini = { version = "0.4.1", default-features = false }

View file

@ -1,3 +1,5 @@
// Booleans (`bool`)
fn main() { fn main() {
let is_morning = true; let is_morning = true;
if is_morning { if is_morning {

View file

@ -1,6 +1,6 @@
fn main() { // Characters (`char`)
// Characters (`char`)
fn main() {
// Note the _single_ quotes, these are different from the double quotes // Note the _single_ quotes, these are different from the double quotes
// you've been seeing around. // you've been seeing around.
let my_first_initial = 'C'; let my_first_initial = 'C';
@ -12,9 +12,12 @@ fn main() {
println!("Neither alphabetic nor numeric!"); println!("Neither alphabetic nor numeric!");
} }
let // Finish this line like the example! What's your favorite character? // TODO: Analogous to the example before, declare a variable called `your_character`
// Try a letter, try a number, try a special character, try a character // below with your favorite character.
// from a different language than your own, try an emoji! // Try a letter, try a digit (in single quotes), try a special character, try a character
// from a different language than your own, try an emoji 😉
// let your_character = '';
if your_character.is_alphabetic() { if your_character.is_alphabetic() {
println!("Alphabetical!"); println!("Alphabetical!");
} else if your_character.is_numeric() { } else if your_character.is_numeric() {

View file

@ -1,12 +1,11 @@
// Create an array with at least 100 elements in it where the ??? is.
fn main() { fn main() {
let a = ??? // TODO: Create an array with at least 100 elements in it where the ??? is.
// let a = ???
if a.len() >= 100 { if a.len() >= 100 {
println!("Wow, that's a big array!"); println!("Wow, that's a big array!");
} else { } else {
println!("Meh, I eat arrays like that for breakfast."); println!("Meh, I eat arrays like that for breakfast.");
panic!("Array not big enough, more elements needed") panic!("Array not big enough, more elements needed");
} }
} }

View file

@ -250,7 +250,7 @@ name = "primitive_types3"
dir = "04_primitive_types" dir = "04_primitive_types"
test = false test = false
hint = """ hint = """
There's a shorthand to initialize Arrays with a certain size that does not There's a shorthand to initialize arrays with a certain size that doesn't
require you to type in 100 items (but you certainly can if you want!). require you to type in 100 items (but you certainly can if you want!).
For example, you can do: For example, you can do:

View file

@ -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!");
}
}

View file

@ -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");
}
}