Hello, World!
puts "Hello, World!"Tap Run to execute
main.rb · output appears here
Press Run to execute
Output streams here as your program runs.
Ruby is a dynamic, open-source programming language with a focus on simplicity and developer productivity. It was created by Yukihiro "Matz" Matsumoto in Japan and first released publicly in 1995. Ruby is purely object-oriented (everything is an object), supports functional and imperative styles, and is known for its elegant, readable syntax and powerful metaprogramming.
Ruby is widely used for web development, most famously through the Ruby on Rails framework, as well as for scripting, automation, DevOps tooling, and prototyping. Its rich standard library and the RubyGems ecosystem make it a productive choice for building APIs, command-line tools, and full-stack web applications.
main.rb is the entry point. Add helper files from the explorer and import them into your project.
Use the Input panel to pipe standard input to your program when it needs data.
Run sends your code to a fresh hosted runtime and streams the result into the output panel.
Your draft stays in this browser, and Share creates a separate snapshot link.
main.rb loads helper.rb relative to the project directory.
require_relative "helper"
puts answer
def answer
42
end
puts "Hello, World!"print "Enter your name: "
name = gets.chomp
puts "Hello, #{name}!"fruits = ["apple", "banana", "cherry"]
fruits.each_with_index do |fruit, i|
puts "#{i + 1}: #{fruit}"
enddef factorial(n)
(1..n).reduce(1, :*)
end
puts factorial(5)begin
n = Integer("abc")
puts n
rescue ArgumentError => e
puts "Invalid number: #{e.message}"
ensure
puts "Done"
endcounts = Hash.new(0)
"banana".each_char { |ch| counts[ch] += 1 }
counts.each { |ch, n| puts "#{ch}: #{n}" }s = " Hello, World "
puts s.strip.upcase
puts s.strip.split(", ").inspect
puts [3, 1, 2].sort.inspectclass Person
attr_reader :name, :age
def initialize(name, age)
@name = name
@age = age
end
def describe
"#{@name} (#{@age})"
end
end
puts Person.new("Ada", 36).describenums = [1, 2, 3, 4, 5]
evens = nums.select { |n| n.even? }
doubled = evens.map { |n| n * 2 }
p doubled
puts "Sum: #{nums.sum}"words = ["pear", "apple", "fig"]
sorted = words.sort_by(&:length)
p sorted
puts words.max_by(&:length)The editor uses Monaco, the engine behind VS Code, with language-aware editing tools and familiar keyboard controls.
Type or paste your code into the editor, then click Run (or press Ctrl/Cmd + Enter) to execute it.
Output streams into the console panel, including runtime errors, exit status, and execution time.
Nothing to install and no account to create — code runs in an isolated hosted runtime.
Language-aware autocomplete and IntelliSense suggestions where the editor has a matching language service
Syntax highlighting, with native compiler and runtime errors shown in the console
Bracket matching, auto-indentation, code folding, and a minimap
Multi-cursor editing plus find & replace (Ctrl/Cmd + F)
Full undo/redo history and copy to clipboard
Built on Monaco — the same editor that powers VS Code
Run on demand, or turn on Auto-run to execute on every change
Stop long-running or infinite programs at any time
A real console shows standard output, errors, exit status, and execution time
Pass standard input (stdin) to your program from the Input panel — one value per line
Switch between light and dark themes
Adjust font size and other editor settings
Toggle side-by-side or top/bottom layouts
Enter distraction-free fullscreen mode
Generate a shareable link to your exact code in one click — no login needed
Your work autosaves to your browser, so you can pick up where you left off
Copy the active file to your clipboard
Run code: Ctrl/Cmd + Enter
Find & replace: Ctrl/Cmd + F
Open the full shortcut list from the keyboard icon in the toolbar
Ruby is one of 23 linked-project compilers. Run always starts main.rb; selecting a helper tab changes what you edit, not the entry file.
main.rb loads helper.rb relative to the project directory.
Linked-project languages (23): Node.js, TypeScript, Deno, Python, C, Go, Dart, Swift, Rust, Ruby, PHP, Java, Kotlin, C++, C#, Nim, Crystal, Haxe, Zig, Scala, D, Bun, Objective-C.
Single-file scratchpads (46): Matplotlib, NumPy, pandas, Haskell, Clojure, Perl, Lua, Tcl, jq, Raku, Elixir, Bash, Zsh, Nushell, R, Assembly (NASM), Julia, Octave, Groovy, PowerShell, Visual Basic .NET, Odin, Pascal, Lisp, Erlang, CoffeeScript, COBOL, BASIC, V, Racket, OCaml, Prolog, AWK, Emacs Lisp, Emojicode, Forth, F#, Fortran, Assembly (NASM64), Solidity, Mojo, Ada, WASM (WAT), Gleam, Shell Script (sh), Scheme. Their extra project files are not submitted to the runtime.
Download project exports every Ruby tab and a README in one ZIP archive.