Created
December 2, 2018 03:59
-
-
Save toshimasa-nanaki/aabb05a26a1596b772b69a1906ed1cf5 to your computer and use it in GitHub Desktop.
Rust 関数(基本)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
print_2times_number(7); | |
print_multiply_number(7,8); | |
} | |
//第1引数を2倍した数を出力 | |
fn print_2times_number(x: i32) { | |
println!("When x is doubled, {}.", x * 2); | |
} | |
//第1引数と第2引数を掛け算した結果を出力 | |
fn print_multiply_number(x: i32, y: i32) { | |
println!("When multiplied by x and y, {}.", x * y); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment