Challenge 1: Refactor to Idiomatic Ruby — Solution # Before: # evens = [] # [1,2,3,4,5,6].each { |n| if n.even? then evens.push(n) end } # After: evens = [1, 2, 3, 4, 5, 6].select(&:even?) puts evens.inspect # Before: # status = nil # if age < 18 then status = "minor" else status = "adult" end # After: age = 25 status = age < 18 ? "minor" : "adult" puts status =begin Output: [2, 4, 6] adult Notes: - select(&:even?) replaces the manual accumulator entirely: no evens = [] declared beforehand, no .push inside a block — .select already returns a new array containing just the elements where the block is truthy. - The ternary (age < 18 ? "minor" : "adult") replaces both the temp variable (status = nil) and the if/else reassigning it in two branches, collapsing to one direct assignment. A full if/elsif/else-as-expression would work identically here too; the ternary is simply the more compact choice for a two-branch, single-expression case like this one. - Both rewrites follow the chapter's checklist items: prefer Enumerable over manual loops, and use if/case (or the ternary) as an expression instead of a temp variable mutated across branches. =end