Basic Ruby tutorial,
1. Basic Ruby knowledge
1. Ruby
Ruby is a scripting language
Ruby is an object-oriented language
Ruby is a cross-platform language
Ruby is open source software.
2. Ruby getting started Book recommendation
Ruby. Programming: Learning Programming from the father of Ruby (version 2nd)
3. Common Ruby development tools
Any text editor can be used to compile Ruby code, as long as the file is saved at the end of ". rb ".
ScITE
Eclipse (using RDT Plugin)
NetBeans, etc.
4. Ruby's first program
= Begin
The first program "Hello World"
Note: 1. Ruby is a case-sensitive language.
= End
Print "Hello \" Ruby \ "\ n"
P "Hello Ruby \ n"
Puts "Hello \ Ruby"
Puts "Hello", "Good", "xiaoming"
P "Hello", "Good", "xiaoming"
Print "Hello", "Good", "xiaoming"
> Ruby test. rb
Hello "Ruby"
"Hello Ruby \ n"
Hello \ Ruby
Hello
Good
Xiaoming
"Hello"
"Good"
"Xiaoming"
HelloGoodxiaoming> Exit code: 0
5. Basic Ruby knowledge-Numbers
Ruby contains five built-in classes used to represent numbers. In addition, the standard library also contains three Numeric classes. All Numeric objects in Ruby are Numeric class instances, all integers are Integer instances. If an Integer can be contained in a 31-bit binary value, it is an instance of the Fixnum class. Otherwise, it is an instance of the Bignum class, the Bignum object is an integer of any size. If the operand of an operation is a Fixnum object, the result is also true. Ruby uses the Float class to represent the real number in an approximation. This class uses the floating point representation on the local platform. The Complex class represents the plural, and the BigDecimal class represents the real number with any precision. It uses the decimal notation instead of the binary. The Rational class represents the Rational number, that is, the number obtained after the two integers are divided.
To be continued ......