4
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 3 years have passed since last update.

Rubyの入出力

Last updated at Posted at 2020-12-24

!Mac OS X-10.15.7 !ruby-2.7.1p83

出力

print("hello world")

実行結果

$ruby print.rb
hello world

改行されない
他のRubyの出力方法はいろいろある
Commandまとめに載せている

入力

ARGV(argument vector)

puts "hello #{ARGV[0]}"

とコーディングして

$ ruby hello_name.rb Cyoukou

とすると

hello Cyoukou

と出力される
putsで入力された文字列を取得し、Helloの後にくっつけている
他の入力メソッドはCommandまとめに載せている


  • source ~/grad_members_20f/members/wjswnsrud12/memo5.org
4
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
4
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?