[Ruby] Display the contents of variables


I will describe how to display the contents of the prepared variable when using the puts method of Ruby.


Ruby 2.6.5


To display the contents of the variable, write as follows.

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

Execution result


` * The point is that if you enclose it in single quotes, it will be output as it is. ``

Recommended Posts

[Ruby] Display the contents of variables
[Ruby] Cut off the contents of twitter-ads
[Ruby] Code to display the day of the week
I want to be aware of the contents of variables!
[Rails] Check the contents of the object
Replace the contents of the Jar file
[Ruby] See the essence of ArgumentError
(Ruby on Rails6) Display of the database that got the id of the database
Delete all the contents of the list page [Ruby on Rails]
[Ruby] Display today's day of the week using Date class
[Ruby] How to retrieve the contents of a double hash
Check the contents of the Java certificate store
Item 57 Minimize the scope of local variables
Memo: [Java] Check the contents of the directory
part of the syntax of ruby ​​on rails
Folding and unfolding the contents of the Recyclerview
About the initial display of Spring Framework
Ruby from the perspective of other languages
Format the contents of LocalDate with DateTimeFormatter
The contents of the data saved by CarrierWave.
Basics of Ruby
About Ruby variables
[Ruby On Rails] How to search the contents of params using include?
How to find the cause of the Ruby error
[Ruby] Summary of class definitions. Master the basics.
JAVA: jar, aar, view the contents of the file
Verify the contents of the argument object with Mockito
Customize how to divide the contents of Recyclerview
[Ruby] Basic knowledge of class instance variables, etc.
[Delete the first letter of the character string] Ruby
The story of introducing Ajax communication to ruby
Manage the version of Ruby itself with rbenv
Overwrite the contents of config with Spring-boot + JUnit5
I want to var_dump the contents of the intent
[Ruby] "Reference to object" and "Contents of variable"
How to display the result of form input
I checked the number of taxis with Ruby
[Ruby on Rails] Individual display of error messages
[Ubuntu 20.04] Display the day of the week on the date / clock
Count the number of occurrences of a string in Ruby
The world of clara-rules (2)
List the contents of categories created with Active Hash
[Ruby] The role of subscripts in learning elements in arrays
Docker the development environment of Ruby on Rails project
Talking about the merits of database bind variables ((1) Introduction)
Test the contents of an Excel file with JUnit
Judgment of the calendar
The world of clara-rules (4)
I want to display the name of the poster of the comment
I summarized the display format of the JSON response of Rails
The world of clara-rules (1)
The world of clara-rules (3)
definition of ruby method
Features of Static variables
Display the average value of the evaluation as a star
The world of clara-rules (5)
Ruby variables and methods
The idea of quicksort
Ruby, Nokogiri: Get the element name of the selected node
[Technical memo] About the advantages and disadvantages of Ruby
[Rails] How to get the contents of strong parameters