hello world, ruby

用java用了一段时间,有些腻了,而且ruby又是如此之火,所以想看个究竟,虽然我工作中使用ruby的可能性不大,但多学一门新语言总归没什么坏处,而且还可以吸收一些新的东西。

ruby是一种强大的脚本语言,作为脚本语言还有perl和python,我都没用过,为什么会单单选择ruby,我也说不出个所以然(也许ROR的原因),网上也有相关讨论。

下面让我们来看看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迷,也想使用脚本语言,也在选择使用哪种,当他发现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年发布了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更流行,作者也希望在全世界也如此,小日本野心不小)


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按钮,你将看到控制台中的结果

 

 居然发现在那个自带的FreeRIDE,不能输入中文,晕

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值