Skip to main content
⚙️Rustadvanced

Question 1 of 10

trait Greet { fn hello(&self) -> String; }
struct English;
struct Spanish;
impl Greet for English {
    fn hello(&self) -> String { String::from("Hello") }
}
impl Greet for Spanish {
    fn hello(&self) -> String { String::from("Hola") }
}
fn greet(g: &dyn Greet) { println!("{}", g.hello()); }
fn main() {
    greet(&English);
    greet(&Spanish);
}

What's the output?

Tech School/Quiz/Rust (Advanced)