All games

Struct Builder

Order Rust code to create structs, read their fields, and update them.

Challenge 1 of 3Score 0 / 3

Create a Pet named Miso, then print its name.

Use the up and down buttons to reorder the lines.

Type definition
struct Pet {
    name: String,
}
fn main() {
  1. println!("{}", pet.name);
  2. let pet = Pet { name: String::from("Miso") };
}
Back to the lesson