Skip to content

Instantly share code, notes, and snippets.

@ungoldman
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ungoldman/249f5b00e3c39409f4e0 to your computer and use it in GitHub Desktop.
Save ungoldman/249f5b00e3c39409f4e0 to your computer and use it in GitHub Desktop.
rubying while true
~/dev/lab/ruby $ ruby rubying_while_true.rb
10/10 100.0% ██████████
9/10 90.0% █████████
8/10 80.0% ████████
7/10 70.0% ███████
6/10 60.0% ██████
5/10 50.0% █████
4/10 40.0% ████
3/10 30.0% ███
2/10 20.0% ██
1/10 10.0% █
0/10 0.0%
a = 10
b = a
while true
print " #{a.to_s.rjust(b.to_s.length)}/#{b} #{((a/b.to_f)*100.to_i).to_s.rjust(5)}% "
((a/b.to_f)*10).to_i.times {|n| print "\u2588".encode('utf-8') }
puts " "
break if a < 1
sleep 1
a = a - 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment