README for this exercise.
Chris Biscardi: [0:00] In strings2, we once again have to make it compile without changing the function signature, specifically line 8. In our main function body, we let word = String, then we have an if statement that calls a function defined on line 16.
[0:13] Is_a_color_word takes a word and uses the println! Macro to print out "That is a color word I know" or "That is not a color word I know," depending on the value. Is_a_color_word takes a reference to a string as the attempt and returns a Boolean. We use an implicit return to do a number of checks and fall back to the last value.
[0:32] The error message that the Rust compiler is giving us tells us that on line 9 the parameter expected a reference to a string and found a struct string instead. It's also telling us that we could consider borrowing here.
[0:44] If we follow the Rust compiler's instructions and we use a reference to the word as an argument to is_a_color_word, which is what the type signature is asking for, the test will pass.
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!