I bought the Chinese version of Programming Ruby

本文讲述了作者在阅读《Programming Ruby》一书过程中对于Closure概念的理解历程。Closure作为一个新术语,在Ruby中有着重要的作用。通过对比英文版与中文版书籍的内容,作者最终掌握了Closure的概念,并给出了一个具体的Ruby代码示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Yesterday morning,When I read the 4.2.3 chapter of the ruby book named <Programming Ruby>,I couldn't understand the meaning of this chapter.I have been reading this book for 2 weeks,but I only read fifty pages.I thought of the speed was too slowly and it was waste of time,then I bought a Chinese version of this book.

After I bought the Chinese book I know the meaning of 'Closure'.
'Closure'  is a  new  jargon which I had heard of a year ago.Although I know it,I didn't know what it means.The following is a example which is showed in <Programming Ruby>,but I don't know where I can use this new feature.
ruby 代码
 
def n_times(thing)   return lambda {|n| thing * n }   end   p1 = n_times(23)   p1.call(3) ! 69   p1.call(4) ! 92   p2 = n_times("Hello ")   p2.call(3) ! "Hello Hello Hello "     


This blog might be finished yesterday afternoon,but it was delayed by other thing.I wrote this blog as soon as I came in my office on this morning.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值