Last Updated: November 21, 2025
Basics
puts "Hello World"
arr = [1, 2, 3]
arr.each { |x| puts x }
hash = { name: "John" }
Methods
def method
Define method
yield
Call block
.each
Iterate
💡 Pro Tip:
Everything is an object in Ruby!