Ruby Syntax and Data Types

Lesson 2 of 20

puts, variables and the core values — Integer, Float, String, Symbol, true, false and nil — all in one tour.

The big picture

The building blocks

Ruby lines are short and friendly: print values with puts, store them in variables, and never declare a type.

puts prints a line

puts takes any value, prints it and moves the cursor to the next line.

Variables just happen

Write name = "Ada" and the variable exists — there is no type to declare, ever.

The core value family

Integer, Float, String, Symbol, true/false and nil cover almost everything you touch at first.

Comments with #

Anything after # on a line is a note for humans — Ruby skips right past it.