Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
0
Help us understand the problem. What is going on with this article?
@tbpgr

ずんだのハロウィン問題 Ruby編

More than 1 year has passed since last update.

ルール

  • 入力として "trick", "treat", "sushi", "poyayou", "tamakatsu" がランダムに与えられる
  • 入力をそのまま標準出力する
  • 入力が "trick" または "treat" だったら "happy halloween" と標準出力する
  • 入力が "trick" または "treat" ではなかったら "sleepy" と標準出力する

プログラム(Ruby)

input = %w(trick treat sushi poyayou tamakatsu).sample
puts input
puts %w(trick treat).include?(input) ? "happy halloween" : "sleepy"

出力例

trick
happy halloween
poyayou
sleepy
0
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
tbpgr
Rubyを扱う人事(研修開発、エンジニア採用) Learning Designer。 tbpgr の読み方は(てぃーびー) 個人ブログでも色々と情報を垂れ流してます。 http://tbpgr.hatenablog.com/
studist
「伝えることを、もっと簡単に」をミッションにビジュアルSOPマネジメントプラットフォームのBtoB SaaS「Teachme Biz」を開発・運営するスタートアップ

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
0
Help us understand the problem. What is going on with this article?