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.

配列をそのままターミナルに表示するためには

Posted at

配列numbers = [1, 3, 5]
そのままターミナルに出力させようとしたが表示されないので、
間違えていた部分をまとめました。

文字列か否かを、頭の中で整理できていない時があるので注意したいと思います。

誤①

.rb
numbers = [1, 3, 5]
puts numbers 

(出力)

1
3
5

  

誤②

.rb
numbers = [1, 3, 5]
puts "numbers" 

(出力)

numbers

  

.ruby
numbers = [1, 3, 5]
puts "numbers" + numbers.to_s

(出力)

numbers[1, 3, 5]
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?