Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

:

.. 2538

Yukihiro Matsumoto

Yukihiro Matsumoto

1.9.0

: 25 , .. 2550

:

, , , , ,Dylan CLU

:
:

Ruby License GPL

www.ruby-lang.org

(Ruby)

, , Dylan CLU

Yukihiro Matsumoto "Matz" 24 .. 1993


..1995 " "
Matsumoto Perl ( )

1.9.1

Matz
Matz

"

"


(principle of least surprise; POLS)

Matz
" Matz " Matz

Matz "

'
'
""


"
:
# []
# :
-199.abs
# 199
"ruby is cool".length
# 12
"Rick".index ("c")
#2
"Nice Day Isn't It?".split (//).uniq.sort.join # " '?DINaceinsty"

source: thairuby

:
a = [1, 'hi', 3.14, 1, 2, [[4, 5]]
a[2]
# 3.14
a.reverse
# [[4, 5]], 2, 1, 3.14, 'hi', 1]
a.flatten.uniq
# [1, 'hi', 3.14, 2, 4, 5]
:
hash = {'water' => 'wet', 'fire' => 'hot'}
puts hash['fire'] # Prints: hot
hash.each_pair do |key, value|
puts "#{key} is #{value}"
end
# :
water is wet
#
fire is hot
hash.delete_if {|key, value| key == 'water'} # 'water' => 'wet'

http://www.ruby-lang.org/en/downloads/
2. http://thairuby.wordpress.com/

You might also like