Skip to content
Justice Tech School

Ruby Syntax

Ruby needs no semicolons or parentheses for most calls. Blocks end with end. Indentation is only style. Comments start with #. Everything evaluates to a value.

Example
# comment
puts "Syntax"
puts(1 + 2)
x = if true then "yes" else "no" end
puts x

Result

Syntax
3
yes

Exercise

Close a block.

if true
  puts 1

Quiz Test

What closes a Ruby block?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.