# Updating percent completed - single line

**URL:** <https://www.ruby-forum.com/t/updating-percent-completed-single-line/193150>\
**Category:** Ruby\
**Created:** [August 12, 2010, 6:34am UTC](https://www.ruby-forum.com/t/updating-percent-completed-single-line/193150 "2010-08-12T06:34:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fartbagxp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/49beb7/32.png) [@fartbagxp](https://www.ruby-forum.com/u/fartbagxp)\
**Post date:** [August 12, 2010, 6:34am UTC](https://www.ruby-forum.com/t/updating-percent-completed-single-line/193150/1 "2010-08-12T06:34:09Z")

</div>

I’m rather new to Ruby and I’m trying to figure out how to print out  
percentage completed message on a single line instead of printing out  
massive amount of messages like the following:

Percentage completed: 1%,  
Percentage completed: 15%,  
Percentage completed: 50%,… so on…

It should just be one line.  
Percentage completed: ("#{percent\_completed\_variable}%")

Thank you…

---

<div class="post-metadata">

**Author:** ![fartbagxp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/49beb7/32.png) [@fartbagxp](https://www.ruby-forum.com/u/fartbagxp)\
**Post date:** [August 12, 2010, 6:50am UTC](https://www.ruby-forum.com/t/updating-percent-completed-single-line/193150/2 "2010-08-12T06:50:50Z")

</div>

On Thu, Aug 12, 2010 at 12:34 PM, Boris X. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> It should just be one line.  
> Percentage completed: (“#{percent\_completed\_variable}%”)

try the ff in irb,

101.times{|x| printf “#{x}%%\r” ;sleep 1}

best regards -botp

---

<div class="post-metadata">

**Author:** ![fartbagxp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/49beb7/32.png) [@fartbagxp](https://www.ruby-forum.com/u/fartbagxp)\
**Post date:** [August 12, 2010, 6:53am UTC](https://www.ruby-forum.com/t/updating-percent-completed-single-line/193150/3 "2010-08-12T06:53:28Z")

</div>

botp wrote:

> On Thu, Aug 12, 2010 at 12:34 PM, Boris X. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> wrote:
> 
> > It should just be one line.  
> > Percentage completed: (“#{percent\_completed\_variable}%”)
> 
> try the ff in irb,
> 
> 101.times{|x| printf “#{x}%%\r” ;sleep 1}
> 
> best regards -botp

Thanks a lot, that solves it.
