0
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]変数の中身を表示する

Posted at

概要

Rubyのputsメソッドを使用したときに、用意した変数の中身を表示する方法を記します。

環境

Ruby 2.6.5

内容

変数の中身を表示する場合は以下のように記述します。

number = 10
puts number
puts "#{number}"
puts '#{number}'

実行結果

10
10
#{number}

`※ポイントは、シングルクォーテーションで囲った場合はそのまま出力されてしまうところです。`

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