Ruby Data Types
Core types: Integer, Float, String, Symbol, Array, Hash, Range, true, false and nil. class shows the type, and is_a? tests it.
Example
puts 42.class, 3.5.class, "s".class, :sym.class, [1].class, {a: 1}.class, nil.class
puts 5.is_a?(Integer)Result
Integer Float String Symbol Array Hash NilClass true
Exercise
Show the type.
5.Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.