📅  最后修改于: 2023-12-03 15:19:51.735000             🧑  作者: Mango
Ruby is a dynamic, open-source programming language with a focus on simplicity, productivity, and flexibility. It allows developers to write clean and concise code using a syntax that is easy to read and understand.
# Define a class
class Person
attr_accessor :name, :age
def initialize(name, age)
@name = name
@age = age
end
def say_hello
puts "Hello, my name is #{@name} and I am #{@age} years old."
end
end
# Create a new instance of the class
person = Person.new("Jane Smith", 25)
# Call the say_hello method
person.say_hello
Ruby is used in a variety of applications, including:
Ruby is a powerful and versatile programming language that is easy to learn and use. With its focus on productivity and flexibility, it is a great choice for developers looking to write clean and concise code. Whether you are working on web development, automation, game development, or data analysis, Ruby has something to offer.