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.
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.
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.