Last active
August 29, 2015 14:11
-
-
Save ungoldman/249f5b00e3c39409f4e0 to your computer and use it in GitHub Desktop.
rubying while true
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/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% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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