A block is a chunk of code passed to a method, enclosed in { } (one line) or do...end (multi-line). Blocks are a distinctive, central Ruby feature — they're how you pass behavior to methods, powering iteration, callbacks, and Ruby's elegant, expressive style.
Block syntax
[, , ].each { || puts n }
[, , ].each ||
doubled = n *
puts doubled
