1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Rubyで三項演算子を使う

Posted at

Rubyで三項演算子を使いました

標準出力から、str1、str2にそれぞれ文字を入力し、同じ文字なら「Yes」、違う文字なら「No」と表示する例です。

ソースコード

str1 = gets.chomp
str2 = gets.chomp
puts str1 == str2 ? "Yes" : "No"

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?