Ruby Cheat Sheet

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!
← Back to Programming Languages | Browse all categories | View all cheat sheets