Ruby getting started-Ruby Installation

Source: Internet
Author: User

To install Ruby, go to the ruby official website to download the Windows Installation Package of ruby1.56. After installing Ruby, open the DOS window and enter ruby-V to display it.

Ruby 1.8.6 (patchlevel 0) [i386-mswin32] indicates that Ruby has been installed successfully and the version is Ruby 1.96.

After installation, choose Start>ProgramThe ruby-186-20 program is displayed. Open him. There are five sub-menus below.

1. Ruby documentation (which contains Ruby Online Documentation)

2. rubygems (a ruby library management tool)

3. fxri (Ruby background and help tools)

4. scite (an editing tool)

5. upload tool

Ruby execution:

After Ruby is installed, Ruby tools are added to the environment variables of the system, so Ruby can be used for compilation in any path *. RB files, but you also have other options, that is, the installed fxri tool. Fxri is a collection of help and background tools. It is the main function that processes an IRB file by default. How can you input your helloworld, puts "helloworld" in it to output helloworld. In this way, you do not need to write the RB file first and then compile it.

Ruby Syntax:

Ruby syntax is very simple. My full-time job is a Java program. in Java, each program must have a class at the beginning. For example, if helloworld is defined, the main method can be defined in helloworld. But ruby can be used as a scripting language. We don't have to worry about it. In addition, in Java, defining a variable must declare the type of the variable. Ruby is not directly needed.

A = 1

In this way, you can declare a variable. By default, Ruby variables are of variable type. That is, a = 1 and then a = "helloworld", let a point to 1 first, and then let a point to helloworld"

Object-oriented:

Everything is object! Another idea is continued in ruby. In Ruby, all variables are objects, including basic types. So you can use

3. Times {puts "Hello! "}, Because 3 is also an object, which contains the Times method. You can also use "gin joint ". length» 9 "Rick ". index ("C")» 2-1942.abs» 1942 Sam. play (Asong)» "duh dum, da dum de dum..."

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: info-contact@alibabacloud.com 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.