Color theme
0 day streak0 XPP1
RubyLearn mode
MISSION 1 OF 1

Shortlist film clips

0 XP earned
Ruby track: BeginnerMission: IntermediateSelection blocksArray mappingBoundary conditions
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.

x
0 / 2 challenges
LEARN THE CONCEPT

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.

quest.rb
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.