Welcome & Hello World
Ruby is a dynamic, open-source programming language with a focus on simplicity and productivity. Created in the mid-1990s by Yukihiro "Matz" Matsumoto in Japan, its design philosophy centers on user-friendly execution and making developers happy.
1 Interpretive Execution Model
Ruby is a dynamically-typed, interpreted scripting language. The Ruby interpreter reads and executes source code directly, enabling fast iteration cycles. Ruby forms the backend of the powerful model-view-controller web framework **Ruby on Rails**.
2 Writing Hello World: puts vs print
Let's run a classic Hello World script in Ruby. Note how simple the syntax is compared to compiled languages:
Ruby — Hello World
▶ Run Code
puts "Hello, World!"
print "Welcome to "
print "Our Ruby Compiler!\n"
Let's examine output utilities:
- puts: Outputs text and automatically appends a newline at the end.
- print: Outputs text without appending a newline, keeping the console cursor on the same line.
3 Code Challenge
Challenge: Edit the code block in the editor. Use the `p` command to output a string (e.g. `p "Test"`). Observe how `p` prints the raw representation of objects, including surrounding quotes, which is highly useful for debugging.