0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

多言語FizzBuzzチャレンジ3日目:Rust

Last updated at Posted at 2022-12-02

ここまでのまとめ

本日のお品書き

今をときめくRustさんです。
ちょっとずつRust tourやったりはしてますが、実際にコードを書く機会が無いのでそのたびに忘れていますね…。

FizzBuzz

fn main() {
    // Rustよ、君もセミコロン派か…
    for i in 1..101 {
        if i % 15 == 0 {
            println!("FizzBuzz");
        } else if i % 3 == 0 {
            println!("Fizz");
        } else if i % 5 == 0 {
            println!("Buzz");
        } else {
            println!("{}", i);
        }
    }
}

所有権の話とか出なければ、書きっぷりはC言語に近しいですね。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?