a guest Apr 21st, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # 標準入力から得られた数字までの FizzBuzz を出力
  2. # 引数に 1 ~ 100 の数値を指定してコマンドラインで以下を実行
  3. $ ruby -e 'raise "illegal arguments. $ {this code} 1 to 100 number argument." unless [*1..100].include?(ARGV[0].to_i); 1.upto(ARGV[0].to_i){|i| out="#{[:Fizz][i%3]}#{[:Buzz][i%5]}"; p out.empty? ? i : out}'
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand