mirror of
https://github.com/gnu4cn/rust-lang-zh_CN.git
synced 2026-08-22 14:13:28 +08:00
Initial commit.
This commit is contained in:
8
functions/Cargo.toml
Normal file
8
functions/Cargo.toml
Normal file
@@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "functions"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
9
functions/src/main.rs
Normal file
9
functions/src/main.rs
Normal file
@@ -0,0 +1,9 @@
|
||||
fn main() {
|
||||
let x = plus_one(-1);
|
||||
|
||||
println! ("x 的值为:{}", x);
|
||||
}
|
||||
|
||||
fn plus_one(x: i32) -> i32 {
|
||||
x + 1
|
||||
}
|
||||
Reference in New Issue
Block a user