Skip to content

Commit

Permalink
Init hello world
Browse files Browse the repository at this point in the history
  • Loading branch information
dhavli committed Nov 3, 2023
1 parent 6fb84e6 commit be44f66
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ Cargo.lock

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
rustlings/**
8 changes: 8 additions & 0 deletions helloworld_01/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "helloworld_01"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
13 changes: 13 additions & 0 deletions helloworld_01/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use std::io;

fn main() {
println!("Enter your name:");

let mut name: String = String::new();
io::stdin()
.read_line(&mut name)
.expect("Failed to read your name!");

let name: &str = name.trim();
println!("Hello, {}!", name);
}

0 comments on commit be44f66

Please sign in to comment.