Ruby中式编程之线程二及代码行级优化
def 姜修艳陈翔宇=0while 陈翔宇<=2puts “姜修艳 at: #{Time.now}”sleep(2)陈翔宇=陈翔宇+1endenddef 周慧慧陈鸿玮=0while 陈鸿玮<=2puts “周慧慧 at: #{Time.now}”sleep(1)陈鸿玮=陈鸿玮+1endendputs “开始于 #{Time.now}”陈元才=Thread.new{姜修艳()}陈鹏飞=Thread.new{周慧慧()}陈元才.join陈鹏飞.joinpu.