Ruby Inheritance Explained – Learn OOP Today!

Class inheritance is a fundamental OOP (Object-Oriented Programming) feature that helps you create a more specific & specialized version of any class. Here’s an example: Food -> Fruit -> Orange There’s a relationship between these classes! We can say that an orange is a fruit, but fruits are also food. The parent class (also called … Read more

How To Use Environment Variables in Ruby

An environment variable is a key/value pair, it looks like this: We use these variables to share configuration options between all the programs in your computer. That’s why it’s important to learn how they work & how to access them from your Ruby programs using the ENV special variable. Examples of environment variables: You can … Read more

What is A Matrix & How to Use It in Ruby?

A matrix is a 2D (2-dimensional) array that can be used to store & work with spreadsheet-like data. They can be used for: Representing a board in a table game (chess, checkers, etc.) Statistics & data analysis Generating plots & graphs Because this is a powerful data structure it’s helpful to learn how to use … Read more

How to Create Ruby Objects That Describe Themselves

In this article you’ll learn how the Ruby inspect method works & why do we use it. When you print a string or array you see its contents. Example: puts [1,2,3] 1 2 3 But when you print your own objects… You see this: #<Cat:0x29458e0> Why? Because you haven’t told Ruby how to display this … Read more