From: Thomas Preymesser Date: 2008-02-14T18:26:38+09:00 Subject: Re: my noob "numbering lines" programe. How to improve? ------=_Part_614_28556412.1202981033261 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 13/02/2008, Adam Akhtar wrote: > > > numdigits =3D 1 > x =3D 1 > while (x < totalnumlines) > x =3D x * 10 > numdigits =3D numdigits + 1 > end you don't need such a loop. this can be replaced with numdigits =3D Math.log10(totalnumlines).to_i+1 -Thomas --=20 Thomas Preymesser thopre@gmail.com thomas@thopre.com B=FCro: 030 - 830 353 88 mobil: 0176 - 75 03 03 04 Privat: 030 - 49 78 37 06 http://thopre.wordpress.com/ http://www.thopre.com/ ------=_Part_614_28556412.1202981033261--