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

【Ruby】ターミナルでコンピュータと対話しながら設定を行う方法

Last updated at Posted at 2025-04-30

Rubyコマンドを実行したときに、ユーザとコンピュータが対話しながらCLIの設定を行う方法を簡単にメモとして残しておきます。

サンプルコード

puts "何かしらの文字を入力してください"

input = gets.chomp

puts "入力された文字は #{input} です"

getsメソッドは標準入力からユーザーの入力を読み取るRubyの組み込みメソッドです。
これを使用することで、ユーザの入力をRubyプログラムへ反映させることができます。

今回はこれだけです。

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