Questions
Ruby questions
Choose a question page, learn the concept, then test your understanding with a quiz.
Ruby Equality Methods Explained: equal?, eql?, ==, and ===
Learn the difference between Ruby's equal?, eql?, ==, and ===, with examples, semantics, and when each method is used.
Ruby Gemfile `require: false` Explained
Learn what `require: false` means in a Ruby Gemfile, how Bundler loads gems, and when to use it in real Ruby projects.
Ruby Loop Control: The Equivalent of continue in Ruby
Learn the Ruby equivalent of continue, how `next` works in loops, and when to use it with clear examples and common mistakes.
Ruby Loops: Alternatives to a do...while Loop in Ruby
Learn how to replace a do...while loop in Ruby using begin...end while, loop do, and input patterns for cleaner code.
Ruby Modules vs Classes: What’s the Difference and When to Use Each?
Learn the difference between Ruby modules and classes, when to use each, and how modules help with namespacing and shared behavior.
Ruby Multi-Line Strings Without Concatenation
Learn how to write multi-line strings in Ruby without messy concatenation, including heredoc, adjacent literals, and readable SQL examples.
Ruby String Concatenation: Using Interpolation, +, and <<
Learn Ruby string concatenation with interpolation, +, and <<. Understand the differences, mutation behavior, and best practices.
Ruby alias vs alias_method: When to Use Each
Learn the difference between Ruby alias and alias_method, when to use each, and how method aliasing works with clear examples.
Ruby attr_accessor vs attr_reader vs attr_writer Explained
Learn when to use Ruby's attr_accessor, attr_reader, and attr_writer, and why choosing the right one improves design and safety.
Ruby begin, rescue, and ensure Explained: Is ensure Like finally?
Learn how Ruby begin, rescue, and ensure work, when ensure runs, and how to safely handle files and exceptions in Ruby.
Ruby case Statement with Multiple Values in when Clauses
Learn how to use Ruby case statements with multiple values in a when clause, plus patterns, examples, mistakes, and alternatives.
Ruby exec vs system vs backticks (%x): Differences, Return Values, and When to Use Each
Learn the difference between Ruby exec, system, and backticks (%x), including return values, process behavior, and practical use cases.
Ruby frozen_string_literal: true Explained for Beginners
Learn what `# frozen_string_literal: true` does in Ruby, how it affects string mutability, performance, and when to use it.
Ruby include vs extend: Understanding Modules and Mixins
Learn the difference between include and extend in Ruby, with clear examples of instance methods, class methods, and practical mixin usage.
Ruby kind_of? vs instance_of? vs is_a?: Differences and When to Use Them
Learn the difference between Ruby kind_of?, is_a?, and instance_of?, including inheritance behavior, examples, and when to use each.
Ruby lambda vs Proc.new: Differences, Return Behavior, and When to Use Each
Learn the differences between Ruby lambda and Proc.new, including arguments, return behavior, and when to use each in Ruby 1.8 and 1.9+.
Ruby map vs collect: Is There Any Difference?
Learn the difference between Ruby map and collect, including syntax, behavior, performance, and when developers usually prefer one.
Ruby on Rails 4 Data Types Explained for Migrations and Models
Learn the available Ruby on Rails 4 data types for migrations, what they mean, and when to use each one in real projects.
Ruby on Rails Instance Variables vs Local Variables Explained
Learn the difference between @variables and regular variables in Ruby on Rails, when to use each, and how scope affects controllers and views.
Shell Languages vs Scripting Languages: Why Bash Feels Different from Python
Learn why shell languages like Bash differ from Python, Perl, and Ruby, and what makes shells better for command-line tasks.