ruby是一種強大的腳本語言,作為腳本語言還有perl和python,我都沒用過,為什么會單單選擇ruby,我也說不出個所以然(也許ROR的原因),網(wǎng)上也有相關討論。
下面讓我們來看看Programming Ruby-2nd Ed的preface中ruby的設計者Yukihiro Matsumoto怎么說的
Years later I talked with colleagues about scripting languages, their power and possibility.
As an object-oriented fan for more than fifteen years, it seemed to me that OO
programming was very suitable for scripting too. I did some research on the ’net for a
while, but the candidates I found, Perl and Python, were not exactly what I was looking
for. I wanted a language more powerful than Perl and more object-oriented than
Python.
(可以看出作者也是OO迷,也想使用腳本語言,也在選擇使用哪種,當他發(fā)現(xiàn)perl不夠強大
和Python不夠OO的時候,他就設計了ruby,強!)
Then, I remembered my old dream and decided to design my own language. At first I
was just toying around with it at work. But gradually it grew to be a tool good enough
to replace Perl. I named it Ruby—after the precious red stone—and released it to the
public in 1995.
(作者只是開始玩玩ruby后來當ruby變得強大,能取代perl的時候,作者于95年發(fā)布了ruby)
Since then a lot of people have become interested in Ruby. Believe it or not, Ruby is
actually more popular than Python in Japan right now. I hope that eventually it will be
just as well received all over the world.
(ruby在日本比python更流行,作者也希望在全世界也如此,小日本野心不?。?/p>
I believe that the purpose of life is, at least in part, to be happy. Based on this belief,
Ruby is designed to make programming not only easy but also fun. It allows you to
concentrate on the creative side of programming, with less stress. If you don’t believe
me, read this book and try Ruby. I’m sure you’ll find out for yourself.
(設計ruby的目的是為了使編程不僅容易而且好玩)
把ruby說得夠猛,不排除作者在作廣告,但也難怪,不吹吹,連作者都不自信,誰會用
廢話說了這么多,開始hello word ruby
1)step1
下載ruby184-17_rc2.exe(this is for xp)
2) step2
安裝完成后,運行自帶的FreeRIDE,敲入代碼:
puts "hello,ruby"
(上面的代碼類似java中的System.out.println("hello,ruby"))
選擇IDE的run菜單和點擊run按鈕,你將看到控制臺中的結(jié)果
居然發(fā)現(xiàn)在那個自帶的FreeRIDE,不能輸入中文,暈