Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4. Read user input #2

Open
prophen opened this issue Jan 23, 2020 · 2 comments
Open

4. Read user input #2

prophen opened this issue Jan 23, 2020 · 2 comments

Comments

@prophen
Copy link
Owner

prophen commented Jan 23, 2020

https://github.com/prophen/intro-to-rust/blob/nikema's-notes/exercises/04.md

  • Memory safety is the guarantee that Rust gives us
  • ownership means values get passed and when the value is no longer needed it is dropped
  • borrowing is passing by reference
String -> &String -> &str
Value       Reference    String Slice?

use std::io;

fn main() {
    println!("Hi, what's your name? ");
    let mut name = String::new();
    io::stdin().read_line(&mut name).unwrap();
    println!("Hello {}", name);
}
@prophen prophen created this issue from a note in Intro to Rust Workshop (In progress) Jan 23, 2020
@prophen
Copy link
Owner Author

prophen commented Jan 23, 2020

image

@prophen prophen moved this from In progress to Done in Intro to Rust Workshop Jan 23, 2020
@prophen
Copy link
Owner Author

prophen commented Jan 23, 2020

next issue #3
Go back to wiki

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant