intro and variables
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
Cargo.lock
|
Cargo.lock
|
||||||
target/
|
target/
|
||||||
.vscode/
|
.vscode/
|
||||||
|
solutions/
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
// Try adding a new `println!` and check the updated output in the terminal.
|
// Try adding a new `println!` and check the updated output in the terminal.
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
println!("hello world!\n");
|
||||||
println!(r#" Welcome to... "#);
|
println!(r#" Welcome to... "#);
|
||||||
println!(r#" _ _ _ "#);
|
println!(r#" _ _ _ "#);
|
||||||
println!(r#" _ __ _ _ ___| |_| (_)_ __ __ _ ___ "#);
|
println!(r#" _ __ _ _ ___| |_| (_)_ __ __ _ ___ "#);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
// TODO: Fix the code to print "Hello world!".
|
// TODO: Fix the code to print "Hello world!".
|
||||||
printline!("Hello world!");
|
println!("Hello world!");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
// TODO: Add the missing keyword.
|
// TODO: Add the missing keyword.
|
||||||
x = 5;
|
let x = 5;
|
||||||
|
|
||||||
println!("x has the value {x}");
|
println!("x has the value {x}");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
// TODO: Change the line below to fix the compiler error.
|
// TODO: Change the line below to fix the compiler error.
|
||||||
let x;
|
let x: i32 = 0;
|
||||||
|
|
||||||
if x == 10 {
|
if x == 10 {
|
||||||
println!("x is ten!");
|
println!("x is ten!");
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
// TODO: Change the line below to fix the compiler error.
|
// TODO: Change the line below to fix the compiler error.
|
||||||
let x: i32;
|
let x: i32 = 0;
|
||||||
|
|
||||||
println!("Number {x}");
|
println!("Number {}", x);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// TODO: Fix the compiler error.
|
// TODO: Fix the compiler error.
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = 3;
|
let mut x = 3;
|
||||||
println!("Number {x}");
|
println!("Number {x}");
|
||||||
|
|
||||||
x = 5; // Don't change this line
|
x = 5; // Don't change this line
|
||||||
|
|||||||
@@ -3,6 +3,6 @@ fn main() {
|
|||||||
println!("Spell a number: {number}");
|
println!("Spell a number: {number}");
|
||||||
|
|
||||||
// TODO: Fix the compiler error by changing the line below without renaming the variable.
|
// TODO: Fix the compiler error by changing the line below without renaming the variable.
|
||||||
number = 3;
|
let number = 3;
|
||||||
println!("Number plus two is: {}", number + 2);
|
println!("Number plus two is: {}", number + 2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// TODO: Change the line below to fix the compiler error.
|
// TODO: Change the line below to fix the compiler error.
|
||||||
const NUMBER = 3;
|
const NUMBER: i32 = 3;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("Number: {NUMBER}");
|
println!("Number: {NUMBER}");
|
||||||
|
|||||||
Reference in New Issue
Block a user