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.

多言語FizzBuzzAdvent Calendar 2022

Day 12

多言語FizzBuzzチャレンジ12日目:Nim

Last updated at Posted at 2022-12-11

これまでのまとめ

本日のお品書き

Nimさん。下記のような記事を読んで気にはなっていた存在。

FizzBuzz

for i in 1..100:
  # 1..100はbuilt-inのcountup(1,100)と等価
  # 最後の要素を含めるのが少し感覚と合わない
  if i mod 15 == 0:
    # 人類は%かmodか統一すべき...
    
    # stringリテラルは厳密に" "
    echo "FizzBuzz"
  elif i mod 3 == 0:
    echo "Fizz"
  elif i mod 5 == 0:
    echo "Buzz"
  else:
    echo i

おまけ

今回も環境構築はスキップ。オンライン実行環境があると手をつけやすくて良いですね。(ちとコンパイルは遅かったけど)

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?