You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Instantiate a `Point`let point:Point = Point{x:10.3,y:0.4};let another_point:Point = Point{x:5.2,y:0.2};// Access the fields of the pointprintln!("point coordinates: ({}, {})", point.x, point.y);// Make a new point by using struct update syntax to use the fields of our// other onelet bottom_right = Point{x:5.2, ..another_point };// `bottom_right.y` will be the same as `point.y` because we used that field// from `point`println!("second point: ({}, {})", bottom_right.x, bottom_right.y);
Which prints
point coordinates: (10.3, 0.4)
second point: (5.2, 0.2)
As you can see, it is the same as another_point.y, and not point.y :)
The text was updated successfully, but these errors were encountered:
I was about to report the same issue 😅
The comment should be changed to:
// `bottom_right.y` will be the same as `another_point.y` because we used that field
We could also change the code, but then the println! wouldn't make sense because it was supposed to print the values of the "second" point (although a third is created).
At least, I'm pretty sure.
Line for reference:
Which prints
As you can see, it is the same as another_point.y, and not point.y :)
The text was updated successfully, but these errors were encountered: