Ruby的数据类型

Ruby中,一切皆对象。

实例
Integer110100
Float0.12.510.0
Complex2i3 + 4i
String'haha'"haha"
TrueClasstrue
FlaseClassfalse
NilClassnil
Range(1..5)(1...10)Range.new
Array[1,2,3,5]['a','b','c']
Hash{}{key1:value1, key2:value2}
Symbol:variable:'string'
RegexpRegexp.new/regular expression/%r{regular expression}
MathMath.sinMath.log
TimeTime.newTime.now
ThreadThread.newThread.main
FiberThread.newThread.yield
IOIO.newIO.openIO.readIO.writeIO.pipe
FileFile.newFile.openFile.readFile.writeFile.pipe
DirDir.newDir.openDir.pwdDir.homeDir.mkdir