Variables and Data Types

name = “Saim” # String
age = 25 # Integer
height = 5.9 # Float
is_student = true # Boolean

puts “Name: #{name}, Age: #{age}, Height: #{height}, Student: #{is_student}”
Ruby is dynamically typed → no need to mention string, int, etc.

{} → used inside strings for interpolation (inserting values).

Output:


Name: Saim, Age: 25, Height: 5.9, Student: true

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *