From f7103f86b3065d22a65c77e2cf34993478512fdd Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Thu, 21 Jul 2016 20:58:04 -0400 Subject: [PATCH] Give structs a bit more motivation they deserve it --- src/ch05-00-structs.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ch05-00-structs.md b/src/ch05-00-structs.md index 14ca071..b623fe3 100644 --- a/src/ch05-00-structs.md +++ b/src/ch05-00-structs.md @@ -1,7 +1,12 @@ # Structs -`struct`s give us the ability to package up multiple values and -keep them in one related structure. +`struct`s, short for "structures", give us the ability to name and package +together multiple related values that make up a meaningful group. If you come +from an object-oriented language, `struct`s are like an object's data +attributes. `structs`, along with `enum`s that we talked about in the last +chapter, are the building blocks you can use in Rust to create new types in +your program's domain in order to take full advantage of Rust's compile-time +type checking. Let’s write a program which calculates the distance between two points. We’ll start off with single variable bindings, and then refactor it to