...

/

Data Types in Ruby

Data Types in Ruby

Learn about the different data types in Ruby.

We'll cover the following...

Data types

In the previous chapters, we figured out how to join two strings with "+". Also, we know now that we can multiply a string by a number. While experimenting, we found that there are at least two types of data: strings and numbers, also known as integers. We also learned that a number itself, written in quotation marks, is a string. Let’s see how Ruby understands what a number and what a string is:

Press + to interact
# Experimenting to see how Ruby understands a number and a string
puts "blabla".class
puts "123".class
puts 123.class

The documentation says that everything is an object in Ruby. So, the result of any operation is an object. Every object implements a method called a class. The expression ...