Mistři v programování na #hovnokod

Ruby #150

progress Bar

# progress bar

width = 60  # width of bar
com   = 540 # input data

pr = com * 0.01
i = 0
j = width

v = 1
puts
while pr <= com

  print "\r#{v}% [#{"|"*i}#{" "*j}]"

  pr += com * 0.01  

  i += width * 0.01
  j -= width * 0.01

  v += 1  
  
  sleep(0.01)
  
end
puts

Anonymous,