Introduction
Ruby reads and runs your code step by step while the program is running. This helps it understand what to do right away.
Ruby reads and runs your code step by step while the program is running. This helps it understand what to do right away.
# Ruby code is written normally and run directly puts 'Hello, world!' # Ruby reads and executes each line one by one
puts 'Hello, world!'
x = 5 puts x + 3
def greet(name) puts "Hello, #{name}!" end greet('Alice')
This program shows how Ruby reads and runs each line one by one, updating values and printing results as it goes.
puts 'Start running code' number = 10 puts "Number is #{number}" number += 5 puts "Number after adding 5 is #{number}" # Ruby reads and runs each line in order
Ruby's interpreter runs code line by line, so errors stop the program immediately.
You can use IRB (Interactive Ruby) to try code snippets and see how Ruby runs them instantly.
Ruby reads and runs code step by step while the program runs.
This lets you see results immediately without compiling.
It is great for quick testing and dynamic programs.
count = 0 3.times do count += 1 end print count
def greet puts "Hello" end greet(1)
def add(x, y) x + y end result = add(2, 3) + add(4, 5) print result
Pass the test and this pattern moves unknown