Skip to content

Commit

Permalink
3.3 function #6
Browse files Browse the repository at this point in the history
  • Loading branch information
euledge committed Feb 12, 2019
1 parent c4a82e9 commit 4c4ddf0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Chapter3.3/functions/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "functions"
version = "0.1.0"
authors = ["euledge <[email protected]>"]
edition = "2018"

[dependencies]
28 changes: 28 additions & 0 deletions Chapter3.3/functions/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
fn main() {
println!("Hello, world!");

another_function(5, 6);
another_function2();

let x = five();
println!("The value of x is: {}", x);
}

fn another_function(x: i32, y: i32) {
println!("The value of x is: {}", x);
println!("The value of y is: {}", y);
}

fn another_function2() {
let x = 5;

let y = {
let x = 3;
x + 1
};
println!("The value of y is: {}", y);
}

fn five() -> i32 {
5
}

0 comments on commit 4c4ddf0

Please sign in to comment.