mirror of
https://github.com/rust-lang/book.git
synced 2026-11-30 18:54:32 -06:00
Add some notes to Liz
This commit is contained in:
@@ -134,11 +134,16 @@ fn area(dimensions: (u32, u32)) -> u32 {
|
||||
}
|
||||
```
|
||||
|
||||
<!-- I will add ghosting & wingdings once we're in libreoffice /Carol -->
|
||||
|
||||
In one way, this is a little better. Tuples let us add a bit of structure, and
|
||||
we’re now passing just one argument. But in another way this method less clear:
|
||||
tuples don’t give names to their elements, so our calculation has gotten more
|
||||
confusing because we have to index into the parts of the tuple:
|
||||
|
||||
<!-- I will change this to use wingdings instead of repeating this code once
|
||||
we're in libreoffice /Carol -->
|
||||
|
||||
```rust,ignore
|
||||
dimensions.0 * dimensions.1
|
||||
```
|
||||
@@ -178,6 +183,8 @@ fn area(rectangle: &Rectangle) -> u32 {
|
||||
}
|
||||
```
|
||||
|
||||
<!-- Will add ghosting & wingdings once we're in libreoffice /Carol -->
|
||||
|
||||
Here we've defined a `struct` and given it the name `Rectangle`. Inside the
|
||||
`{}` we defined the fields to be `length` and `width`, both of which have type
|
||||
`u32`. Then in `main`, we create a particular instance of a `Rectangle` that
|
||||
|
||||
Reference in New Issue
Block a user