Complete primitive_types section
This commit is contained in:
parent
9290bde71a
commit
46dd23f067
|
@ -10,7 +10,7 @@ fn main() {
|
||||||
println!("Good morning!");
|
println!("Good morning!");
|
||||||
}
|
}
|
||||||
|
|
||||||
let // Finish the rest of this line like the example! Or make it be false!
|
let is_evening = false; // Finish the rest of this line like the example! Or make it be false!
|
||||||
if is_evening {
|
if is_evening {
|
||||||
println!("Good evening!");
|
println!("Good evening!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,10 @@ fn main() {
|
||||||
println!("Neither alphabetic nor numeric!");
|
println!("Neither alphabetic nor numeric!");
|
||||||
}
|
}
|
||||||
|
|
||||||
let // Finish this line like the example! What's your favorite character?
|
// Finish this line like the example! What's your favorite character?
|
||||||
// Try a letter, try a number, try a special character, try a character
|
// Try a letter, try a number, try a special character, try a character
|
||||||
// from a different language than your own, try an emoji!
|
// from a different language than your own, try an emoji!
|
||||||
|
let your_character = '6';
|
||||||
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() {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// Scroll down for hints!
|
// Scroll down for hints!
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let a = ???
|
let a = [0; 101];
|
||||||
|
|
||||||
if a.len() >= 100 {
|
if a.len() >= 100 {
|
||||||
println!("Wow, that's a big array!");
|
println!("Wow, that's a big array!");
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
let a = [1, 2, 3, 4, 5];
|
let a = [1, 2, 3, 4, 5];
|
||||||
|
|
||||||
let nice_slice = ???
|
let nice_slice = &a[1..3];
|
||||||
|
|
||||||
if nice_slice == [2, 3, 4] {
|
if nice_slice == [2, 3, 4] {
|
||||||
println!("Nice slice!");
|
println!("Nice slice!");
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let cat = ("Furry McFurson", 3.5);
|
let cat = ("Furry McFurson", 3.5);
|
||||||
let /* your pattern here */ = cat;
|
let (name, age) = cat;
|
||||||
|
|
||||||
println!("{} is {} years old.", name, age);
|
println!("{} is {} years old.", name, age);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let numbers = (1, 2, 3);
|
let numbers = (1, 2, 3);
|
||||||
println!("The second number is {}", ???);
|
println!("The second number is {}", numbers.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue