mirror of
https://github.com/rust-lang/book.git
synced 2026-11-30 19:24:32 -06:00
Merge pull request #52 from clemensw/structs_compare_to_tuples
Example Point changes coordinates.
This commit is contained in:
+2
-2
@@ -143,7 +143,7 @@ struct Point {
|
||||
y: f64,
|
||||
}
|
||||
|
||||
let p1 = Point { x: 0.0, y: 0.0 };
|
||||
let p1 = Point { x: 0.0, y: 5.0 };
|
||||
```
|
||||
|
||||
Here’s what declaring a `struct` looks like:
|
||||
@@ -176,7 +176,7 @@ struct Point {
|
||||
y: f64,
|
||||
}
|
||||
|
||||
let p1 = Point { x: 0.0, y: 0.0 };
|
||||
let p1 = Point { x: 0.0, y: 5.0 };
|
||||
let x = p1.x;
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user