Ruby¶
Dynamic, object-oriented language focused on simplicity and productivity
Overview¶
Ruby is an elegant, dynamic programming language with a focus on simplicity and productivity. Known for its readable syntax and powerful metaprogramming capabilities, Ruby is widely used for web development (Ruby on Rails), scripting, and automation.
With run, you can execute Ruby code instantly using the Ruby interpreter. The Ruby engine provides a stateful REPL where variables, methods, and classes persist across commands.
Language Aliases¶
Basic Usage¶
Simple Output¶
Variables and Interpolation¶
Arrays and Iteration¶
Multi-line Code¶
Best Practice: Use Heredoc
For multi-line Ruby code, use heredoc to avoid quoting issues:
REPL Behavior¶
Ruby's REPL is STATEFUL - variables and methods persist across commands.