About Ruby Programming Language

Overview

Ruby is a dynamic, reflective, object-oriented programming language known for its simplicity and productivity. It's often used for web development, scripting, and more.

Example: Hello World

Here's a basic "Hello, World!" program in Ruby:

puts 'Hello, World!'

Variables and Operations

Ruby supports variables and operations similarly to other languages:

a = 10
b = 5
sum = a + b
product = a * b

puts "Sum: #{sum}"
puts "Product: #{product}"

Conditional Statements

Using conditional statements in Ruby:

number = 10

if number > 0
  puts 'The number is positive.'
else
  puts 'The number is not positive.'
end

Loops

Example of a loop in Ruby:

5.times do |i|
  puts "Number: #{i + 1}"
end