1. 15
    Rustlings primitive_types2: String and Character literals using different quote styles
    47s

Rustlings primitive_types2: String and Character literals using different quote styles

Chris Biscardi
InstructorChris Biscardi
Share this video with your friends

Social Share Links

Send Tweet
Published 4 years ago
Updated 3 years ago

README for this exercise.

Chris Biscardi: [0:00] In primitive_types 2, we have a main() function with a body that sets my_first_initial the character 'C.' We know this is a character because we use single quotes here. Double quotes indicates a string. We have a number of functions that are called on a character that don't exist on strings.

[0:15] On line 19, we have to finish the line. Note that the error message doesn't do us much good here because we need to finish the let line which is missing code. In this case, we'll take your_character which is the variable that we need and try to set it to a string.

[0:31] You'll know that because we use double quotes. There's no method named is_alphabetic bound for reference and string in the current scope. If we change this to use single quotes and remember to add our semicolon, then our tests pass is_alphabetic and is_numeric are functions on characters, not strings.

egghead
egghead
~ 2 hours ago

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

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

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!

Markdown supported.
Become a member to join the discussionEnroll Today