Shortlist film clips
Before you start this beginner track
Variables, arrays, and key-value data. Collection blocks are a step beyond basic syntax.
Guided code reading and debugging. Runnable coding challenges are available in JavaScript, Python, and SQL.
Understand it, then try it.
A film editor needs labels for clips shorter than thirty seconds. select runs a block for every duration and keeps those for which the block returns true. map then turns the retained numbers into strings with a seconds suffix. Finally, join creates a compact shortlist without changing the original durations.
clips = [12, 30, 28, 60]shorts = clips.select { |seconds| seconds < 30 }labels = shorts.map { |seconds| "#{seconds}s" }puts labels.join(" / ")Each mission is an independent Ruby 3 or later script. Save as quest.rb and run ruby quest.rb. All methods are built into Ruby; no gems or external data are needed.
Track the values line by line. Predict the result before running this example in your own editor.