Complete these tasks to reinforce what you learned in this module.
Define a struct Person with fields name: String and age: u32. Create an instance with name "Alice" and age 30, then print both fields.
name you need an owned string (see the ownership module). Create an instance with the struct literal syntax.// Task 1: Struct Person. See tasks/TASKS.md.
fn main() {
todo!("Define Person, create instance, print name and age");
}
Add an impl block for Person with a method greet(&self) -> String that returns format!("Hello, I'm {} and I'm {} years old.", self.name, self.age). Create a Person, call greet(), and print the result.
impl block; use &self to borrow the struct. Use format! for the string; the expected output tells you the name and age to use.// Task 2: impl greet. See tasks/TASKS.md.
fn main() {
todo!("Add impl Person with greet(), call and print");
}