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.

rubycomparisonoperatorsequality

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.

rubybundlergemfile

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.

rubykeywordcontinue

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.

rubyloops

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.

rubyclassmodule

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.

rubycode-formatting

Ruby String Concatenation: Using Interpolation, +, and <<

Learn Ruby string concatenation with interpolation, +, and <<. Understand the differences, mutation behavior, and best practices.

rubystring-concatenation

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.

rubyalias

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.

rubyattributesattr-accessor

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.

rubyexceptionerror-handling

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.

rubyswitch-statement

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.

rubyexec

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

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.

rubymoduleincludeextend

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.

rubyinheritanceintrospection

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+.

rubylambdaproc

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.

rubyarraysdictionarycollect

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.

rubyruby-on-railsruby-on-rails-4rails-activerecord

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.

rubyruby-on-railsvariables

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.

rubypythonperlbash

Page 5 of 6 - 112 questions