From 3e22087c7c1dcac713161e786aa1b3568a099206 Mon Sep 17 00:00:00 2001 From: Gijs Burghoorn Date: Thu, 30 Nov 2023 22:14:47 +0100 Subject: [PATCH] Start of intro-to-programming module --- .../0-introduction-to-programming-concepts.md | 0 .../mods/Z-starting-programming/1-types.md | 0 .../2-divide-and-conquer.md | 0 .../3-scopes-and-globals.md | 0 .../mods/Z-starting-programming/4-memory.md | 0 .../5-inputs-and-outputs.md | 0 .../6-command-line-and-cargo.md | 0 .../7-modules-and-multi-file.md | 0 .../8-intermediate-programming-concepts.md | 0 .../exercises/arrays.rs | 21 +++ .../exercises/conditionals.rs | 12 ++ .../exercises/first-program.rs | 5 + .../exercises/functions.rs | 19 +++ .../exercises/variables.rs | 12 ++ .../images/A0-abstract-program.svg | 16 +++ .../images/A0-mutation-sum-warning.png | Bin 0 -> 14851 bytes content/mods/Z-starting-programming/mod.toml | 0 .../slides.md | 0 .../topic.toml | 0 .../basics-of-the-command-line/slides.md | 0 .../basics-of-the-command-line/topic.toml | 0 .../topics/bits-and-bit-operations/slides.md | 0 .../topics/bits-and-bit-operations/topic.toml | 0 .../topics/booleans/slides.md | 57 ++++++++ .../topics/booleans/topic.toml | 0 .../topics/cargo-basics/slides.md | 0 .../topics/cargo-basics/topic.toml | 0 .../topics/comments/slides.md | 0 .../topics/comments/topic.toml | 0 .../topics/composition-structures/slides.md | 25 ++++ .../topics/composition-structures/topic.toml | 0 .../topics/conditionals/slides.md | 95 +++++++++++++ .../topics/conditionals/topic.toml | 0 .../topics/constants/slides.md | 0 .../topics/constants/topic.toml | 0 .../copy-by-value-and-reference/slides.md | 0 .../copy-by-value-and-reference/topic.toml | 0 .../topics/enums/slides.md | 0 .../topics/enums/topic.toml | 0 .../topics/functions/slides.md | 0 .../topics/functions/topic.toml | 0 .../topics/heap/slides.md | 29 ++++ .../topics/heap/topic.toml | 0 .../topics/hello-world-analysis/slides.md | 26 ++++ .../topics/hello-world-analysis/topic.toml | 0 .../topics/lists-and-loops/slides.md | 123 +++++++++++++++++ .../topics/lists-and-loops/topic.toml | 0 .../topics/modules/slides.md | 0 .../topics/modules/topic.toml | 0 .../topics/multi-file-projects/slides.md | 0 .../topics/multi-file-projects/topic.toml | 0 .../topics/mutation/slides.md | 49 +++++++ .../topics/mutation/topic.toml | 0 .../topics/numbers/slides.md | 33 +++++ .../topics/numbers/topic.toml | 0 .../topics/overview-memory/slides.md | 0 .../topics/overview-memory/topic.toml | 0 .../topics/printing/slides.md | 0 .../topics/printing/topic.toml | 0 .../topics/public-and-private/slides.md | 0 .../topics/public-and-private/topic.toml | 0 .../topics/ranges/slides.md | 0 .../topics/ranges/topic.toml | 0 .../topics/reading-input/slides.md | 0 .../topics/reading-input/topic.toml | 0 .../topics/recursion/slides.md | 0 .../topics/recursion/topic.toml | 0 .../topics/references-and-pointers/slides.md | 0 .../topics/references-and-pointers/topic.toml | 0 .../topics/scopes/slides.md | 55 ++++++++ .../topics/scopes/topic.toml | 0 .../topics/stack/slides.md | 24 ++++ .../topics/stack/topic.toml | 0 .../topics/standard-library/slides.md | 0 .../topics/standard-library/topic.toml | 0 .../topics/text-and-strings/slides.md | 40 ++++++ .../topics/text-and-strings/topic.toml | 0 .../topics/tuples/slides.md | 0 .../topics/tuples/topic.toml | 0 .../topics/types-intro/slides.md | 27 ++++ .../topics/types-intro/topic.toml | 0 .../topics/variables/slides.md | 36 +++++ .../topics/variables/topic.toml | 0 .../topics/what-is-programming/slides.md | 128 ++++++++++++++++++ .../topics/what-is-programming/topic.toml | 0 .../topics/why-divide-and-conquer/slides.md | 58 ++++++++ .../topics/why-divide-and-conquer/topic.toml | 0 87 files changed, 890 insertions(+) create mode 100644 content/mods/Z-starting-programming/0-introduction-to-programming-concepts.md create mode 100644 content/mods/Z-starting-programming/1-types.md create mode 100644 content/mods/Z-starting-programming/2-divide-and-conquer.md create mode 100644 content/mods/Z-starting-programming/3-scopes-and-globals.md create mode 100644 content/mods/Z-starting-programming/4-memory.md create mode 100644 content/mods/Z-starting-programming/5-inputs-and-outputs.md create mode 100644 content/mods/Z-starting-programming/6-command-line-and-cargo.md create mode 100644 content/mods/Z-starting-programming/7-modules-and-multi-file.md create mode 100644 content/mods/Z-starting-programming/8-intermediate-programming-concepts.md create mode 100644 content/mods/Z-starting-programming/exercises/arrays.rs create mode 100644 content/mods/Z-starting-programming/exercises/conditionals.rs create mode 100644 content/mods/Z-starting-programming/exercises/first-program.rs create mode 100644 content/mods/Z-starting-programming/exercises/functions.rs create mode 100644 content/mods/Z-starting-programming/exercises/variables.rs create mode 100644 content/mods/Z-starting-programming/images/A0-abstract-program.svg create mode 100644 content/mods/Z-starting-programming/images/A0-mutation-sum-warning.png create mode 100644 content/mods/Z-starting-programming/mod.toml create mode 100644 content/mods/Z-starting-programming/topics/associated-functions-and-methods/slides.md create mode 100644 content/mods/Z-starting-programming/topics/associated-functions-and-methods/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/basics-of-the-command-line/slides.md create mode 100644 content/mods/Z-starting-programming/topics/basics-of-the-command-line/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/bits-and-bit-operations/slides.md create mode 100644 content/mods/Z-starting-programming/topics/bits-and-bit-operations/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/booleans/slides.md create mode 100644 content/mods/Z-starting-programming/topics/booleans/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/cargo-basics/slides.md create mode 100644 content/mods/Z-starting-programming/topics/cargo-basics/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/comments/slides.md create mode 100644 content/mods/Z-starting-programming/topics/comments/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/composition-structures/slides.md create mode 100644 content/mods/Z-starting-programming/topics/composition-structures/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/conditionals/slides.md create mode 100644 content/mods/Z-starting-programming/topics/conditionals/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/constants/slides.md create mode 100644 content/mods/Z-starting-programming/topics/constants/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/copy-by-value-and-reference/slides.md create mode 100644 content/mods/Z-starting-programming/topics/copy-by-value-and-reference/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/enums/slides.md create mode 100644 content/mods/Z-starting-programming/topics/enums/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/functions/slides.md create mode 100644 content/mods/Z-starting-programming/topics/functions/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/heap/slides.md create mode 100644 content/mods/Z-starting-programming/topics/heap/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/hello-world-analysis/slides.md create mode 100644 content/mods/Z-starting-programming/topics/hello-world-analysis/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/lists-and-loops/slides.md create mode 100644 content/mods/Z-starting-programming/topics/lists-and-loops/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/modules/slides.md create mode 100644 content/mods/Z-starting-programming/topics/modules/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/multi-file-projects/slides.md create mode 100644 content/mods/Z-starting-programming/topics/multi-file-projects/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/mutation/slides.md create mode 100644 content/mods/Z-starting-programming/topics/mutation/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/numbers/slides.md create mode 100644 content/mods/Z-starting-programming/topics/numbers/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/overview-memory/slides.md create mode 100644 content/mods/Z-starting-programming/topics/overview-memory/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/printing/slides.md create mode 100644 content/mods/Z-starting-programming/topics/printing/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/public-and-private/slides.md create mode 100644 content/mods/Z-starting-programming/topics/public-and-private/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/ranges/slides.md create mode 100644 content/mods/Z-starting-programming/topics/ranges/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/reading-input/slides.md create mode 100644 content/mods/Z-starting-programming/topics/reading-input/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/recursion/slides.md create mode 100644 content/mods/Z-starting-programming/topics/recursion/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/references-and-pointers/slides.md create mode 100644 content/mods/Z-starting-programming/topics/references-and-pointers/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/scopes/slides.md create mode 100644 content/mods/Z-starting-programming/topics/scopes/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/stack/slides.md create mode 100644 content/mods/Z-starting-programming/topics/stack/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/standard-library/slides.md create mode 100644 content/mods/Z-starting-programming/topics/standard-library/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/text-and-strings/slides.md create mode 100644 content/mods/Z-starting-programming/topics/text-and-strings/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/tuples/slides.md create mode 100644 content/mods/Z-starting-programming/topics/tuples/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/types-intro/slides.md create mode 100644 content/mods/Z-starting-programming/topics/types-intro/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/variables/slides.md create mode 100644 content/mods/Z-starting-programming/topics/variables/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/what-is-programming/slides.md create mode 100644 content/mods/Z-starting-programming/topics/what-is-programming/topic.toml create mode 100644 content/mods/Z-starting-programming/topics/why-divide-and-conquer/slides.md create mode 100644 content/mods/Z-starting-programming/topics/why-divide-and-conquer/topic.toml diff --git a/content/mods/Z-starting-programming/0-introduction-to-programming-concepts.md b/content/mods/Z-starting-programming/0-introduction-to-programming-concepts.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/1-types.md b/content/mods/Z-starting-programming/1-types.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/2-divide-and-conquer.md b/content/mods/Z-starting-programming/2-divide-and-conquer.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/3-scopes-and-globals.md b/content/mods/Z-starting-programming/3-scopes-and-globals.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/4-memory.md b/content/mods/Z-starting-programming/4-memory.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/5-inputs-and-outputs.md b/content/mods/Z-starting-programming/5-inputs-and-outputs.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/6-command-line-and-cargo.md b/content/mods/Z-starting-programming/6-command-line-and-cargo.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/7-modules-and-multi-file.md b/content/mods/Z-starting-programming/7-modules-and-multi-file.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/8-intermediate-programming-concepts.md b/content/mods/Z-starting-programming/8-intermediate-programming-concepts.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/exercises/arrays.rs b/content/mods/Z-starting-programming/exercises/arrays.rs new file mode 100644 index 00000000..9946e8a3 --- /dev/null +++ b/content/mods/Z-starting-programming/exercises/arrays.rs @@ -0,0 +1,21 @@ +fn main() { + let list = [1, 1337, 42]; + + let mut sum = 0; + for number in list { + sum = sum + number; + } + + // TODO: print the following: + // 1. print the numbers one by one + // 2. an addition line + // 3. the sum + // + // For example, for the list [5, 9, 2] your output would be: + // + // 5 + // 9 + // 2 + // -------+ + // 16 +} \ No newline at end of file diff --git a/content/mods/Z-starting-programming/exercises/conditionals.rs b/content/mods/Z-starting-programming/exercises/conditionals.rs new file mode 100644 index 00000000..3a0458f0 --- /dev/null +++ b/content/mods/Z-starting-programming/exercises/conditionals.rs @@ -0,0 +1,12 @@ +fn main() { + let age = 17; + + if age > 17 { + println!("You are an adult 👩"); + } else { + println!("You are a child 🧒"); + } + + // TODO: Add a clause for 13 - 17 year olds to be `teenagers` + // TIP: you can use the 🏫 emoji +} \ No newline at end of file diff --git a/content/mods/Z-starting-programming/exercises/first-program.rs b/content/mods/Z-starting-programming/exercises/first-program.rs new file mode 100644 index 00000000..d1ad206b --- /dev/null +++ b/content/mods/Z-starting-programming/exercises/first-program.rs @@ -0,0 +1,5 @@ +fn main() { + println!("Hello World"); + + // TODO: add another print, where it prints your name +} \ No newline at end of file diff --git a/content/mods/Z-starting-programming/exercises/functions.rs b/content/mods/Z-starting-programming/exercises/functions.rs new file mode 100644 index 00000000..74a77032 --- /dev/null +++ b/content/mods/Z-starting-programming/exercises/functions.rs @@ -0,0 +1,19 @@ +fn x_squared_plus_one(number: i32) -> i32 { + // TODO: Implement the expression for this +} + +fn double(number: i32) -> i32 { + 2 * number +} + +fn main() { + let double_6 = double(6); + println!("2 * 6: {double_6}"); + + let six_squared_plus_one = x_squared_plus_one(6); + println!("6*6 + 1: {six_squared_plus_one}"); + + // TODO: Create the function named `x_cubed_plus_x_squared` + let six_cubed_plus_six_squared = x_cubed_plus_x_squared(6); + println!("6*6*6 + 6*6: {six_cubed_plus_six_squared}"); +} \ No newline at end of file diff --git a/content/mods/Z-starting-programming/exercises/variables.rs b/content/mods/Z-starting-programming/exercises/variables.rs new file mode 100644 index 00000000..4fef7044 --- /dev/null +++ b/content/mods/Z-starting-programming/exercises/variables.rs @@ -0,0 +1,12 @@ +fn main() { + let x = 10; + let double_x = 2 * x; + let x_plus_twenty = x + 22; + + // `{x}` is replaced with the value of `x` + println!("x: {x}"); + + // TODO: create variables and print the following expressions: + // * y = (61 + 130) * 7 + // * z = (x + y) * 5 + 2 +} \ No newline at end of file diff --git a/content/mods/Z-starting-programming/images/A0-abstract-program.svg b/content/mods/Z-starting-programming/images/A0-abstract-program.svg new file mode 100644 index 00000000..537c291d --- /dev/null +++ b/content/mods/Z-starting-programming/images/A0-abstract-program.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/content/mods/Z-starting-programming/images/A0-mutation-sum-warning.png b/content/mods/Z-starting-programming/images/A0-mutation-sum-warning.png new file mode 100644 index 0000000000000000000000000000000000000000..96869bd2287eb2d5371a462ee536d0e89b749190 GIT binary patch literal 14851 zcmdVBWmFwa@bEdf1qkjET!ID*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;LS_ytR2rs3mtvXy9{Q=V;MK-)j1swC zUl!A=k>8$2%Bbr<7?(O#&AGMBTbsKG;t@Wrp23h63USE@(F9u2 z;~2}z=#4#}{5{iGz-#CkS5zzY-C9PE@%6f#J&B&Ao&+%~^?TIysd-8iO%L>$&kFH) zp42al>yl>2DX(w5T^tWP8y8AS)8h;%C}_Mqy-?>AO-AR7&dJ5u!blja`#i_4*$Z07 z{KBO-F;71!nwj&ED%aPyJ>!RF8t4Q=uFHGe^<=a8bXnjTQzv zcMiOlYl`;q^z;QGr%*KCE{;3nsZpaIuI_DDzcJGCH=KHpEeGirUcH^X=U*(KbCP|I z@#L5kV7Xe|NQ5*UR;LQSyy3hv1G~S zUL(Z*2S|D|KWecUKVAww?>M~vl6XU1XeQ8OK{$Ai%3ISOM_vyuqZt7Jcyw4v2mKs}qp=CNEwkY7qE;0DVRt>Hq)$ literal 0 HcmV?d00001 diff --git a/content/mods/Z-starting-programming/mod.toml b/content/mods/Z-starting-programming/mod.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/associated-functions-and-methods/slides.md b/content/mods/Z-starting-programming/topics/associated-functions-and-methods/slides.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/associated-functions-and-methods/topic.toml b/content/mods/Z-starting-programming/topics/associated-functions-and-methods/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/basics-of-the-command-line/slides.md b/content/mods/Z-starting-programming/topics/basics-of-the-command-line/slides.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/basics-of-the-command-line/topic.toml b/content/mods/Z-starting-programming/topics/basics-of-the-command-line/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/bits-and-bit-operations/slides.md b/content/mods/Z-starting-programming/topics/bits-and-bit-operations/slides.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/bits-and-bit-operations/topic.toml b/content/mods/Z-starting-programming/topics/bits-and-bit-operations/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/booleans/slides.md b/content/mods/Z-starting-programming/topics/booleans/slides.md new file mode 100644 index 00000000..ecb4aad4 --- /dev/null +++ b/content/mods/Z-starting-programming/topics/booleans/slides.md @@ -0,0 +1,57 @@ +--- +layout: section +--- + +# Types --- Booleans + +--- + +# Types --- Booleans (1) + +* Boolean answer a *yes/no question* (`true` or `false`) +* Examples: + * Is $x$ even? $\to$ $x$ is even + * Is $x$ larger than 42? $\to$ $x$ is larger than 42 + * Does text start with "Wow"? $\to$ text starts with "Wow" + * Is the left mouse button pressed? $\to$ Left mouse button is pressed + +```rust +let is_x_larger_than_42 = x > 42; + +let does_text_start_with_wow = text.starts_with("Wow"); +``` + +--- + +# Types --- Booleans (2) + +* Booleans are also the conditions for `if` + +```rust +let age = 19; +let is_adult = age > 17; + +if is_adult { + println!("You are an adult 👩"); +} else { + println!("You are a child 🧒"); +} +``` + +--- + +# Types --- Booleans (3) + +* Booleans can be combined + * This or that? + * This and that? + +```rust +if number > 10 && number < 20 { + println!("{number} is somewhere between 11 and 19"); +} + +if number < 10 || number > 20 { + println!("{number} is lower than 10 or higher than 20"); +} +``` diff --git a/content/mods/Z-starting-programming/topics/booleans/topic.toml b/content/mods/Z-starting-programming/topics/booleans/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/cargo-basics/slides.md b/content/mods/Z-starting-programming/topics/cargo-basics/slides.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/cargo-basics/topic.toml b/content/mods/Z-starting-programming/topics/cargo-basics/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/comments/slides.md b/content/mods/Z-starting-programming/topics/comments/slides.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/comments/topic.toml b/content/mods/Z-starting-programming/topics/comments/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/composition-structures/slides.md b/content/mods/Z-starting-programming/topics/composition-structures/slides.md new file mode 100644 index 00000000..d95a0cb3 --- /dev/null +++ b/content/mods/Z-starting-programming/topics/composition-structures/slides.md @@ -0,0 +1,25 @@ +--- +layout: section +--- + +# Types --- Composite Structures + +--- + +# Types --- Composite Structures + +* Create our own type by combining types + +```rust +struct Point { + x: i32, + y: i32, +} + +// Define a new point +let p = Point { x: 10, y: 20 }; + +// Print the properties +println!("Point's x: {}", point.x); +println!("Point's y: {}", point.y); +``` diff --git a/content/mods/Z-starting-programming/topics/composition-structures/topic.toml b/content/mods/Z-starting-programming/topics/composition-structures/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/conditionals/slides.md b/content/mods/Z-starting-programming/topics/conditionals/slides.md new file mode 100644 index 00000000..b98e23ae --- /dev/null +++ b/content/mods/Z-starting-programming/topics/conditionals/slides.md @@ -0,0 +1,95 @@ +--- +layout: section +--- + +# Conditionals --- `if` + +--- + +# Conditionals + +* Output changes based on a condition +* *Branches* the execution flow +* Commonly done with `if` and optional `else` + +```rust +if ( + // A condition +) { + // If the condition is true do this. +} else { + // Else do this +} +``` + +--- + +# Conditionals --- Example (1) + +```rust {all|1|3|4} +let age = 19; + +if age > 17 { + println!("You are an adult 👩"); +} else { + println!("You are a child 🧒"); +} +``` + +#### Output: + +``` +You are an adult 👩 +``` + +--- + +# Conditionals --- Example (2) + +#### Code: + +```rust {all|1|3|4} +let age = 12; + +if age > 17 { + println!("You are an adult 👩"); +} else { + println!("You are a child 🧒"); +} +``` + +#### Output: + +``` +You are a child 🧒 +``` + +--- + +# Conditionals --- Example (3) + +```rust {1|3|4} +let role = "Student"; + +// `==` asks whether they are equal +if role == "Administrator" { + println!("All systems operational! 🔓"); +} else { + println!("You don't have the authority!"); +} +``` + +#### Output: + +``` +You are an adult 👩 +``` + +--- + +# Conditionals --- Operations + +- Equality: `==` +- Inequality: `!=` +- Comparison: `<`, `>`, `<=`, `>=` +- Invert: `!` diff --git a/content/mods/Z-starting-programming/topics/conditionals/topic.toml b/content/mods/Z-starting-programming/topics/conditionals/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/constants/slides.md b/content/mods/Z-starting-programming/topics/constants/slides.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/constants/topic.toml b/content/mods/Z-starting-programming/topics/constants/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/copy-by-value-and-reference/slides.md b/content/mods/Z-starting-programming/topics/copy-by-value-and-reference/slides.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/copy-by-value-and-reference/topic.toml b/content/mods/Z-starting-programming/topics/copy-by-value-and-reference/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/enums/slides.md b/content/mods/Z-starting-programming/topics/enums/slides.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/enums/topic.toml b/content/mods/Z-starting-programming/topics/enums/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/functions/slides.md b/content/mods/Z-starting-programming/topics/functions/slides.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/functions/topic.toml b/content/mods/Z-starting-programming/topics/functions/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/heap/slides.md b/content/mods/Z-starting-programming/topics/heap/slides.md new file mode 100644 index 00000000..bb5c17ac --- /dev/null +++ b/content/mods/Z-starting-programming/topics/heap/slides.md @@ -0,0 +1,29 @@ +--- +layout: section +--- + +# Heap + +--- + +# Heap + +- *Heap*: Variables that belong to the entire program. You only get the receipt. +- Receipt is gone $\implies$ variable data is gone +- Useful for: + - Unknown time of use + - Unknown size + +```rust +{ + // `numbers` is only a receipt to the data + let mut numbers = vec![]; + + // numbers = [] + + list_of_numbers.push(1); // numbers = [1] + list_of_numbers.push(3); // numbers = [1, 3] + list_of_numbers.push(3); // numbers = [1, 3, 3] + list_of_numbers.push(7); // numbers = [1, 3, 3, 7] +} // `numbers` gets removed from the stack, so data is also gone +``` diff --git a/content/mods/Z-starting-programming/topics/heap/topic.toml b/content/mods/Z-starting-programming/topics/heap/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/hello-world-analysis/slides.md b/content/mods/Z-starting-programming/topics/hello-world-analysis/slides.md new file mode 100644 index 00000000..5bec9a74 --- /dev/null +++ b/content/mods/Z-starting-programming/topics/hello-world-analysis/slides.md @@ -0,0 +1,26 @@ +--- +layout: section +--- + +# Our First Program + +--- + +# Hello World! + +```rust +fn main() { + println!("Hello World!"); +} +``` + +--- + + + +# Our First Program --- Explained + +* Computer needs to know where to start $\to$ `fn main()` +* Everything in the `{` and `}`, and will get run line by line +* A line is terminated with a `;` +* Here we display `Hello World!` to the screen diff --git a/content/mods/Z-starting-programming/topics/hello-world-analysis/topic.toml b/content/mods/Z-starting-programming/topics/hello-world-analysis/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/lists-and-loops/slides.md b/content/mods/Z-starting-programming/topics/lists-and-loops/slides.md new file mode 100644 index 00000000..e17c9c2b --- /dev/null +++ b/content/mods/Z-starting-programming/topics/lists-and-loops/slides.md @@ -0,0 +1,123 @@ +--- +layout: section +--- + +# Lists and Loops + +--- + +# Lists and Loops + +* List = **Array** +* List of multiple elements + * Usernames and Passwords + * Pixels on the Screen + +```rust +let list = [1, 1337, 42]; +``` + +--- + +# Lists and Loops --- Moving over Elements + +```rust +let list = [1, 1337, 42]; + +for number in list { + println!("{number}"); +} +``` + +#### Output: + +``` +1 +1337 +42 +``` + +--- + +# Lists and Loops --- Sum of Elements + +```rust +let list = [1, 1337, 42]; + +let mut sum = 0; +for number in list { + sum = sum + number; +} + +println!("Sum of List: {sum}"); +``` + +#### Output: + +``` +Sum of List: 1390 +``` + +--- + +# Lists and Loops --- Loops without Lists + +```rust +// NOTE: Does not include `1340` +for number in 1337..1340 { + println!("{number}"); +} +``` + +#### Output: + +``` +1337 +1338 +1339 +``` + +--- + +# Lists and Loops --- Unconditional Loops + +```rust +loop { + println!("Please help! I cannot stop!"); +} +``` + +#### Output: + +``` +Please help! I cannot stop! +Please help! I cannot stop! +Please help! I cannot stop! +Please help! I cannot stop! +... +``` + +--- + +# List and Loops --- Breaking Early + +```rust +let mut number = 1337; +loop { + // If the number is greater than 3, break out of the loop + if number > 1339 { + break; + } + + println!("{number}"); + number = number + 1; +} +``` + +#### Output: + +``` +1337 +1338 +1339 +``` diff --git a/content/mods/Z-starting-programming/topics/lists-and-loops/topic.toml b/content/mods/Z-starting-programming/topics/lists-and-loops/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/modules/slides.md b/content/mods/Z-starting-programming/topics/modules/slides.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/modules/topic.toml b/content/mods/Z-starting-programming/topics/modules/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/multi-file-projects/slides.md b/content/mods/Z-starting-programming/topics/multi-file-projects/slides.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/multi-file-projects/topic.toml b/content/mods/Z-starting-programming/topics/multi-file-projects/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/mutation/slides.md b/content/mods/Z-starting-programming/topics/mutation/slides.md new file mode 100644 index 00000000..71d1915f --- /dev/null +++ b/content/mods/Z-starting-programming/topics/mutation/slides.md @@ -0,0 +1,49 @@ +--- +layout: section +--- + +# Mutation + +--- + +# Mutation (1) + +- How to modify a variable's value? + +```rust +// Get the sum over the items +let items = [1, 3, 3, 7]; +let sum = 0; + +for item in items { + let sum = sum + item; +} + +// Output: `0` +println!("{sum}"); +``` + +--- + +# Mutation (2) + +![Compiler Warning](images/A0-mutation-sum-warning.png) + +--- + +# Mutation (3) + +- Solution: *Mutation* + +```rust +// Get the sum over the items +let items = [1, 3, 3, 7]; +let mut sum = 0; + +for item in items { + sum = sum + item; +} + +// Will output `14` +println!("{sum}"); +``` diff --git a/content/mods/Z-starting-programming/topics/mutation/topic.toml b/content/mods/Z-starting-programming/topics/mutation/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/numbers/slides.md b/content/mods/Z-starting-programming/topics/numbers/slides.md new file mode 100644 index 00000000..6bde8dbc --- /dev/null +++ b/content/mods/Z-starting-programming/topics/numbers/slides.md @@ -0,0 +1,33 @@ +--- +layout: section +--- + +# Types --- Numbers + +--- + +# Types --- Numbers + +| Semantics | Example Values | +|-|-| +| Positive Integers | $0$, $1$, $1337$ | +| Signed Integers | $-1337$, $0$, $42$ | +| Floating Point | $3.1415$, $-4.3$, `INFINITY` | + +## Uses + +* Mathematical equations +* Counting +* Many, many others... + +--- + +# Types --- Signed Integers + +--- + +# Types --- Unsigned Integers + +--- + +# Types --- Floating diff --git a/content/mods/Z-starting-programming/topics/numbers/topic.toml b/content/mods/Z-starting-programming/topics/numbers/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/overview-memory/slides.md b/content/mods/Z-starting-programming/topics/overview-memory/slides.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/overview-memory/topic.toml b/content/mods/Z-starting-programming/topics/overview-memory/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/printing/slides.md b/content/mods/Z-starting-programming/topics/printing/slides.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/printing/topic.toml b/content/mods/Z-starting-programming/topics/printing/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/public-and-private/slides.md b/content/mods/Z-starting-programming/topics/public-and-private/slides.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/public-and-private/topic.toml b/content/mods/Z-starting-programming/topics/public-and-private/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/ranges/slides.md b/content/mods/Z-starting-programming/topics/ranges/slides.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/ranges/topic.toml b/content/mods/Z-starting-programming/topics/ranges/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/reading-input/slides.md b/content/mods/Z-starting-programming/topics/reading-input/slides.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/reading-input/topic.toml b/content/mods/Z-starting-programming/topics/reading-input/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/recursion/slides.md b/content/mods/Z-starting-programming/topics/recursion/slides.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/recursion/topic.toml b/content/mods/Z-starting-programming/topics/recursion/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/references-and-pointers/slides.md b/content/mods/Z-starting-programming/topics/references-and-pointers/slides.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/references-and-pointers/topic.toml b/content/mods/Z-starting-programming/topics/references-and-pointers/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/scopes/slides.md b/content/mods/Z-starting-programming/topics/scopes/slides.md new file mode 100644 index 00000000..039fd9ca --- /dev/null +++ b/content/mods/Z-starting-programming/topics/scopes/slides.md @@ -0,0 +1,55 @@ +--- +layout: section +--- + +# Scopes + +--- + +# Scopes (1) + +- A *scope* is an isolated variable and function environment +- Scope is indicated with `{ ... }` + +```rust +let x = 10; + +{ + let y = 20; +} + +// Will give an error: "cannot find value `y` in this scope" +let z = x + y; +``` + +--- + +# Scopes (2) + +- Many earlier concepts will open a new scope + +#### If Statements + +```rust +if x == y { + let z = 10; // `z` defined in this scope +} +// `z` inaccessible in this scope +``` + +#### Loops + +```rust +for character in text.chars() { + // `character` defined in this scope +} +// `character` inaccessible in this scope +``` + +#### Functions +```rust +fn double(number: i32) -> i32 { + // `number` defined in this scope +} +// `number` inaccessible in this scope +``` diff --git a/content/mods/Z-starting-programming/topics/scopes/topic.toml b/content/mods/Z-starting-programming/topics/scopes/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/stack/slides.md b/content/mods/Z-starting-programming/topics/stack/slides.md new file mode 100644 index 00000000..efde04e2 --- /dev/null +++ b/content/mods/Z-starting-programming/topics/stack/slides.md @@ -0,0 +1,24 @@ +--- +layout: section +--- + +# Stack + +--- + +# Stack + +- *Stack*: Variables that belong to a scope +- Scope ends $\implies$ Variable gone + +```rust +// `a` get pushed on the stack +let a = 3; +{ + // `b` get pushed on the stack + let b = 10; + + // `x` get pushed on the stack + let x = a * b; +} // `b` and `x` get removed from the stack +``` diff --git a/content/mods/Z-starting-programming/topics/stack/topic.toml b/content/mods/Z-starting-programming/topics/stack/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/standard-library/slides.md b/content/mods/Z-starting-programming/topics/standard-library/slides.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/standard-library/topic.toml b/content/mods/Z-starting-programming/topics/standard-library/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/text-and-strings/slides.md b/content/mods/Z-starting-programming/topics/text-and-strings/slides.md new file mode 100644 index 00000000..437ff7d7 --- /dev/null +++ b/content/mods/Z-starting-programming/topics/text-and-strings/slides.md @@ -0,0 +1,40 @@ +--- +layout: section +--- + +# Types --- Text + +--- +layout: three-slots +--- + +# Types --- Text + +::left:: + +- Character: `c`, `🐵`, Space +- String: `Monkey 🐵`, `A piece of text` + +::right:: + +```rust +let text = "Monkey 🐵"; + +for character in text.chars() { + // `print` a `line` (ln) to the screen + println!("{character}"); +} +``` + +#### Output: + +``` +M +o +n +k +e +y + +🐵 +``` diff --git a/content/mods/Z-starting-programming/topics/text-and-strings/topic.toml b/content/mods/Z-starting-programming/topics/text-and-strings/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/tuples/slides.md b/content/mods/Z-starting-programming/topics/tuples/slides.md new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/tuples/topic.toml b/content/mods/Z-starting-programming/topics/tuples/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/types-intro/slides.md b/content/mods/Z-starting-programming/topics/types-intro/slides.md new file mode 100644 index 00000000..6605ffaa --- /dev/null +++ b/content/mods/Z-starting-programming/topics/types-intro/slides.md @@ -0,0 +1,27 @@ +--- +layout: section +--- + +# Types + +--- + +# Types + +* **Types**: *meaning* of a variable +* Catch faulty programs early +* Make it easy for computer to reason about code + +```rust +// Obvious to the computer +let x = 10 + 20; + +// What does this mean? +let x = "This is some text" + 20; +``` + +* Type Categories + * Number (integer, floating point) + * Boolean (yes/no) + * Text (character, string of characters) + * Arbitrary Structure diff --git a/content/mods/Z-starting-programming/topics/types-intro/topic.toml b/content/mods/Z-starting-programming/topics/types-intro/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/variables/slides.md b/content/mods/Z-starting-programming/topics/variables/slides.md new file mode 100644 index 00000000..7adc9cdc --- /dev/null +++ b/content/mods/Z-starting-programming/topics/variables/slides.md @@ -0,0 +1,36 @@ +--- +layout: section +--- + +# Variables + +--- + +# Variables + +```rust +let x = 10; + +let text = "ThIs Is SoMe TeXt"; + +let is_this_a_variable = true; +``` + +--- + +# Variables --- Math + +```rust +let x = 10; +let double_x = 2 * x; +let x_plus_twenty = x + 20; +``` + +--- + +# Variables --- Text + +```rust +let x = 10; +let double_x = 2 * x; +let x_plus_twenty = x + 20; diff --git a/content/mods/Z-starting-programming/topics/variables/topic.toml b/content/mods/Z-starting-programming/topics/variables/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/what-is-programming/slides.md b/content/mods/Z-starting-programming/topics/what-is-programming/slides.md new file mode 100644 index 00000000..c76308d7 --- /dev/null +++ b/content/mods/Z-starting-programming/topics/what-is-programming/slides.md @@ -0,0 +1,128 @@ +--- +layout: section +--- + +# What is Programming + +--- +layout: three-slots +--- + +# **Goal**: let machine turn *Input* into *Output* + +::left:: + +* Examples + * $x \mapsto 2x$ + * "ThIs Is SoMe TeXt" $\mapsto$ "this is some text" + * [1, 1337, 42] $\mapsto$ [uneven, uneven, even] + * Game Assets $\mapsto$ Pixels of the screen + +* Important Questions: + * How to **unambiguously** *express our intentions*? + * How to *revise* our intentions? + +::right:: + +Abstract Program + +--- +layout: three-slots +--- + +# Idea 1: Use Numbers + +::left:: + +* Numbers are simple for computers to understand + +```rust +// x --> 2x +2,x,01 + +// x --> 2x + 6 - 10 +2,x,01,6,02,10,03 + +// x --> 1 + x + x^2 + x^3 +1,x,02,x,x,01,02,x,x,01,x,01,02 +``` + +* **Problem**: Difficult for Humans to reason about + +::right:: + +| Operation Number | Behavior | +|------------------|-------------------------------| +| 01 | Multiply Previous Two Numbers | +| 02 | Add Previous Two Numbers | +| 03 | Subtract Previous Two Numbers | + +--- + +# Idea 2: Use normal language + +* Normal language is understandable people and is known almost everyone + +``` +// x --> 2x +Given an x, multiply 2 with that x. + +// x --> 2x + 6 - 10 +Given an number, multiply two with that number. Add six to that answer and substract ten from the answer. +``` + +* **Problems** + * Ambiguous: "Subtract from that answer". Which answer? + * Difficult to computers to reason about + * Verbose + +--- + +# Idea 3: Programming Language + +* A well-defined language understandable to machines + +```rust +// x --> 1 + x + x^2 + x^3 +let answer = 1 + x + x*x + x*x*x; +``` + +* Properties + * Concise + * Unambiguous + * Understandable to machines + +--- + +# What is Programming (1) + +* Programming Language: *Human-Readable* format to express machine instructions +* This course discusses the *Rust Programming Language* + +```rust +// Multiply `x` by 2 +2 * x + +// Convert some text to lowercase +"ThIs Is SoMe TeXt".to_lowercase() +``` + +--- + +# What is Programming (2) + +* Solve problems by a **divide-and-conquer** approach + +``` +Going to Bed: + 1. Brush Teeth + 1. Find Toothbrush + 2. Find Toothpaste + 3. Put Toothpaste on Toothbrush + 4. ... + 2. Get into Pyjamas + 1. ... + 3. Get into bed +``` + +* $\implies$ Programs consists of smaller *isolated* parts diff --git a/content/mods/Z-starting-programming/topics/what-is-programming/topic.toml b/content/mods/Z-starting-programming/topics/what-is-programming/topic.toml new file mode 100644 index 00000000..e69de29b diff --git a/content/mods/Z-starting-programming/topics/why-divide-and-conquer/slides.md b/content/mods/Z-starting-programming/topics/why-divide-and-conquer/slides.md new file mode 100644 index 00000000..adcbd800 --- /dev/null +++ b/content/mods/Z-starting-programming/topics/why-divide-and-conquer/slides.md @@ -0,0 +1,58 @@ +--- +layout: section +--- + +# Divide-and-Conquer + +--- + +# Divide-and-Conquer --- Functions (1) + +* Functions + * Take in input = *Parameters* + * Give back output = *Return Value* + + +```rust +// The `i32` is an integer type. +// +// `x: i32` gives the Parameters +// `-> i32` gives the Return Value +fn double(x: i32) -> i32 { + 2 * x +} + +// y = 2 * x +let y = double(x); + +// y = 2 * x + 6 +let y = double(x) + 6; +``` + +--- + +# Divide-and-Conquer --- Functions (2) + +```rust +fn brush_teeth() { + let toothbrush = find_toothbrush(); + let toothpaste = find_toothpaste(); + put_on(toothbrush, toothpaste); + + // ... +} + +fn get_into_pyjamas() { + // ... +} + +fn get_into_bed() { + // ... +} + +fn go_to_bed() { + brush_teeth(); + get_into_pyjamas(); + get_into_bed(); +} +``` diff --git a/content/mods/Z-starting-programming/topics/why-divide-and-conquer/topic.toml b/content/mods/Z-starting-programming/topics/why-divide-and-conquer/topic.toml new file mode 100644 index 00000000..e69de29b