返回顶部

收藏

number of minutes you want to count down.

更多
def timer( start )
  puts 'Minutes: ' + start.to_s
  start_time = Time.now
  puts start_time.strftime('Start to_time: %I:%M:%S %p')
  start.downto(1) { |i| sleep 60 }
  end_time = Time.now
  print end_time.strftime('Elapsed time: %I:%M:%S %p')
end

timer 10

标签:Ruby,Statement

收藏

0人收藏

支持

0

反对

0

发表评论