Question on 10.3 Traits, Exercise 6 Returning Types that Implement Traits
dycw opened this issue · comments
Derek Wan commented
Hi @sunface , thanks for a great library!
I'm a little surprised by the answer, I certainly don't think it respects the spirit of the question...
Spoiler warning!
fn random_animal(random_number: f64) -> impl Animal {
if random_number < 0.5 {
Sheep {}
} else {
Sheep {}
}
}
For a beginner, I can't figure out what the answer should be however - help needed please.