Skip to content

Instantly share code, notes, and snippets.

@toshimasa-nanaki
Created December 2, 2018 03:59
Show Gist options
  • Save toshimasa-nanaki/aabb05a26a1596b772b69a1906ed1cf5 to your computer and use it in GitHub Desktop.
Save toshimasa-nanaki/aabb05a26a1596b772b69a1906ed1cf5 to your computer and use it in GitHub Desktop.
Rust 関数(基本)
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