Run Ruby online — Ruby 3.4, 3.3, or 3.x MRI, blocks and metaprogramming, browser-hosted.
Ruby remains the definitive scripting language for developer happiness: clean OO, blocks and yield, extensive metaprogramming, RSpec-style DSL culture. Rails powers a huge slice of the SaaS internet.
ls-judge runs Ruby on MRI inside a Firecracker microVM. Pick Ruby 3.4 for the current line, 3.3 for the last LTS-track release, or the generic 3.x baseline.
Clicking "Run now" opens the playground with this exact code and a matching test case pre-loaded — passes on first Run.
n = gets.chomp.to_i
puts n * 2
21
42