2
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.

授業5回目:出力

Last updated at Posted at 2020-12-26

参考サイト

チャート式ruby-I(puts)

お題:Hello world

まず手始めということで Hello world を出力する.

Hello world.

あとついでに入力した文字で出力結果が変わるようにする.

> ruby hello_name.rb Rudy
Hello Rudy.

実装例

puts を使えば出力できる.

puts "Hello world"

ついでの部分はこちら.

puts "Hello #{ARGV[0]}."

note

ruby で出力をするのにはいくつかの方法がある.
・print :普通に出力 改行が必要
・puts :普通に出力 自動で改行
・p :コーディング中にデバッグ作業として打ち出す時
・pp :pのpretty print
・printf:c言語と同じ感じに


  • source ~/grad_members_20f/members/batamon-427/task5.org
2
0
1

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