Exerpad
🔥 0
0 XP
Exercise 7 · Chapter: Tuples & StructsRequired+50 XP

Student Struct

Define a struct called Student with two fields: name (String) and grade (String). Create a student named "Emma" who got a grade of "A+", then print their result.

Expected output:

Emma got A+

Hints:

  • Define the struct with name: String and grade: String
  • Use String::from(...) when setting field values
  • Print with println!("{} got {}", student.name, student.grade)
rust
fn main() {
}
Output
Run your code to see the output here.