Ruby Language FAQ

Source: Internet
Author: User
Tags exception handling garbage collection

1. What is Ruby?

Ruby is a simple object-oriented programming language that is easy to get started with and powerful. She was a Japanese Yukihiro Matsumoto (everyone called him Matz.) was first released in 1995. Ruby has borrowed a lot from the Perl language (some people say that Ruby is the beautiful sister of Perl:), like Perl, Ruby is also good at text processing, system management, and more. Like Smalltalk, Ruby is a purely object-oriented language, and everything is an object. Here are some features of the Ruby language:

Simple and elegant grammar

Explanatory-type execution, quick and easy

Fully Object oriented

Built-in regular engine for text processing

has many advanced features (operator overloading, mix-ins, Singleton Methods, ...). )

Elegant and perfect exception handling mechanism

Automatic garbage collection

Highly portable (can be run on Windows, Unix, Linux, MacOS)

2. What does Ruby do? Let me see some ruby language code!

As a general-purpose programming language, Ruby, like other common programming languages, can write most of the tasks we encounter on a day-to-day basis, and do it in a simpler and more elegant way. She has been used to write Web server programs, scientific computing programs, video game software, and other interesting applications. More people use her to do the prototype experiment and deal with the trivial programming tasks encountered every day.

You want to see the ruby code? OK, here's the code for a few simple programs written in Ruby:

# 1-Print 3 times "Hello, world!"

3.times do
print "Hello, world!\n"

# 2-Compute "1 + 2 + 3 + ... + 100"sum = 0
for i in 1..100
sum += i
print "1+2+3+...+100 = ", sum, "\n"

# 3-Simple method calldef hello(name)
print "Hello, ", name, "\n"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.