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..."