00:00
02:59

RFS: Variable Assignment and Objects - 002

If you would like to setup ruby on your macOS head over to this video.

In this episode we will explore variable assignment and what people mean when they say "everything is an object" in ruby.
Let's begin with something simple. To start the interactive ruby shell type irb
puts "hello world"=> hello world

Let's assign and number to a variable

number = 2another_number = 3

You'll notice that we are using snake_case in our variable assignment.

number + another_number=> 5

Objects in Ruby

In ruby everything is an object because they can have their own attributes and methods

5.class=> Integer

Calling a .class on a number will show us what class the number was created from.

When everything is an object they have methods and attributes which make up that object. The fact that we can call a .class on the object is an example of the fact that it is an object.