Mise à niveau vers Pro

Introduction to Ruby

What is Ruby?

Ruby is a high-level, easy-to-read programming language created in the mid-1990s by Yukihiro Matsumoto (known as Matz).
It was designed to be:

Simple
Productive
Enjoyable to write

Ruby focuses on making programmers happy by giving them a clean, readable, and flexible language.

Why Ruby Is Popular

1. Very Easy to Learn

Ruby has a clean, English-like syntax.

Example:

puts "Hello, Ruby!"

2. Used for Web Development (Rails)

Ruby became extremely popular because of Ruby on Rails, a powerful web framework used by big companies like:

  • GitHub

  • Shopify

  • Airbnb (early days)

  • Twitter (early days)

3. Flexible and Expressive

Ruby allows multiple ways to do the same thing, giving developers more freedom.

4. Great for Startups

It’s fast to build apps with Ruby because Rails handles a lot automatically.

Basic Ruby Syntax

1. Print text

puts "Hello, world!"

2. Variables

No need to declare types:

name = "Ruby"
age = 10

3. Arrays

fruits = ["apple", "banana", "orange"]
puts fruits[0]   # apple

4. Hashes (like dictionaries)

person = {
  name: "John",
  age: 25
}
puts person[:name]   # John

5. Methods

def greet(name)
  "Hello, #{name}!"
end

puts greet("Alice")

6. Loops

5.times do
  puts "Hello"
end

Ruby on Rails (Big Reason Ruby Is Famous)

Ruby on Rails, usually just called Rails, is a full web framework used to build websites quickly.
It follows:

  • MVC architecture

  • Convention over configuration (Rails sets up most defaults for you)

  • Rapid development (build apps fast)

Many big apps began with Rails such as:

  • Twitter (initially)

  • GitHub

  • Shopify

  • Basecamp

Where Ruby Is Used Today

  • Web development

  • Automation scripts

  • DevOps tools (e.g., Chef, Vagrant)

  • Command-line tools

  • Data processing (less common but possible)

Strengths of Ruby

  • Very easy to read

  • Developer-friendly

  • Great ecosystem for building full websites

  • Strong community

Should You Learn Ruby?

Ruby is great for you if:

✔ You want to build websites quickly
✔ You want to learn programming with an easy, friendly language
✔ You want to use Ruby on Rails (one of the best web frameworks)

Flowisetech For easy access