mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-10 12:49:18 +00:00
working on rustlings
This commit is contained in:
parent
e64fcacd66
commit
8395cdc9a5
@ -9,7 +9,7 @@
|
||||
// when you change one of the lines below! Try adding a `println!` line, or try changing
|
||||
// what it outputs in your terminal. Try removing a semicolon and see what happens!
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
|
||||
fn main() {
|
||||
println!("Hello and");
|
||||
|
||||
@ -2,8 +2,11 @@
|
||||
// Make the code print a greeting to the world.
|
||||
// Execute `rustlings hint intro2` or use the `hint` watch subcommand for a hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
|
||||
fn main() {
|
||||
println!("Hello {}!");
|
||||
|
||||
let mut world = String::from("World");
|
||||
|
||||
println!("Hello {world}!");
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Fill in the rest of the line that has code missing!
|
||||
// No hints, there's no tricks, just get used to typing these :)
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
|
||||
fn main() {
|
||||
// Booleans (`bool`)
|
||||
@ -12,7 +12,7 @@ fn main() {
|
||||
println!("Good morning!");
|
||||
}
|
||||
|
||||
let // Finish the rest of this line like the example! Or make it be false!
|
||||
let is_evening = true;// Finish the rest of this line like the example! Or make it be false!
|
||||
if is_evening {
|
||||
println!("Good evening!");
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Fill in the rest of the line that has code missing!
|
||||
// No hints, there's no tricks, just get used to typing these :)
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
|
||||
fn main() {
|
||||
// Characters (`char`)
|
||||
@ -18,7 +18,7 @@ fn main() {
|
||||
println!("Neither alphabetic nor numeric!");
|
||||
}
|
||||
|
||||
let // Finish this line like the example! What's your favorite character?
|
||||
let your_character = 'S'; // Finish this line like the example! What's your favorite character?
|
||||
// Try a letter, try a number, try a special character, try a character
|
||||
// from a different language than your own, try an emoji!
|
||||
if your_character.is_alphabetic() {
|
||||
|
||||
@ -2,10 +2,10 @@
|
||||
// Create an array with at least 100 elements in it where the ??? is.
|
||||
// Execute `rustlings hint primitive_types3` or use the `hint` watch subcommand for a hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
|
||||
fn main() {
|
||||
let a = ???
|
||||
let a = [1; 100];
|
||||
|
||||
if a.len() >= 100 {
|
||||
println!("Wow, that's a big array!");
|
||||
|
||||
@ -8,3 +8,5 @@ const NUMBER: u32 = 3;
|
||||
fn main() {
|
||||
println!("Number {}", NUMBER);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user