June 2021
Beginner
344 pages
8h 9m
English
Instead of turning away people who aren’t on the visitor list, you decide to let them in and store their names for the next party.
Arrays can’t change size. Vectors (Vec) are designed to be dynamically resizable. They can be used like arrays, but you can add to them with a method named push.[29] Vectors can keep growing—you are limited only by the size of your computer’s memory.
When you were just storing names as strings, printing them was easy. Send them to println! and you’re done. You want to be able to print the contents of a Visitor structure. The debug placeholders ({:?} —for raw printing—and {:#?}, for “pretty” printing) print any type that supports the Debug trait. Adding ...
Read now
Unlock full access