Understanding Everything is an Object in Ruby
📖 Scenario: Imagine you are exploring how Ruby treats everything as an object. This helps you understand how you can call methods on numbers, strings, and even true/false values.
🎯 Goal: You will create variables of different types and call methods on them to see how Ruby treats everything as an object.
📋 What You'll Learn
Create variables of different types: integer, string, and boolean
Create a variable called
number with the value 10Create a variable called
greeting with the value "hello"Create a variable called
is_ruby_fun with the value trueCall the method
.class on each variable to find out its classPrint the class of each variable
💡 Why This Matters
🌍 Real World
Understanding that everything is an object helps you write flexible and powerful Ruby code, since you can use methods on any value.
💼 Career
Many Ruby jobs require you to understand object-oriented concepts, and knowing that all data types are objects is fundamental.
Progress0 / 4 steps