[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] Code to display the day of the week
About the behavior of ruby Hash # ==
[Rails] Check the contents of the object
Replace the contents of the Jar file
(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] How to retrieve the contents of a double hash
Display text on top of the image
Check the contents of params with pry
Item 57 Minimize the scope of local variables
Memo: [Java] Check the contents of the directory
Folding and unfolding the contents of the Recyclerview
Item 57: Minimize the scope of local variables
About the initial display of Spring Framework
Format the contents of LocalDate with DateTimeFormatter
The contents of the data saved by CarrierWave.
Basics of Ruby
Variables / scope (ruby)
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 on Rails] Until the introduction of RSpec
[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
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
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
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
The world of clara-rules (1)
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, 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
Java: Use Stream to sort the contents of the collection
[Ruby] Class nesting, inheritance, and the basics of self
Try using the query attribute of Ruby on Rails
The idea of jQuery
How to display the select field of time_select every 30 minutes
Review the basic knowledge of ruby that is often forgotten
I took a peek at the contents of Java's HashMap
[Ruby] Questions and verification about the number of method arguments
[Ruby on Rails] Quickly display the page title in the browser
A note about the seed function of Ruby on Rails