couple more chapters
This commit is contained in:
6
ch4.md
Normal file
6
ch4.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
- add text to a string
|
||||||
|
- try reassigning the value of a variable to another one, using different types, and see what the compiler says
|
||||||
|
- try passing a String instance and/or a Vector to a function which mutates it
|
||||||
|
- borrow a non-mutable reference and store it in a var, then print a value made from it (e.g. add one to it)
|
||||||
|
- use slicing to get the first word in a multi-word string and print it
|
||||||
|
- use assert_eq! to prove what slicing actually does;
|
||||||
5
ch5.md
Normal file
5
ch5.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
// create a struct Rectangle, make an instance of it, then calculate the area using a function
|
||||||
|
// use dbg! at various points
|
||||||
|
// make a new rectangle instance from the first one
|
||||||
|
// when does the original rectangle stay valid, when not?
|
||||||
|
// add an area method to the Rectangle struct
|
||||||
Reference in New Issue
Block a user