On Tue, 04 Nov 2008 11:12:31 +0100, thiel <schang / wxs.nl> wrote:

> Can anyone tell me how I can print an array with floating point numbers?

printf:

[0.1, 2.3, 4.5, 6.7, 8.9].each { |x| printf("%0.04f\n",x)}
0.1000
2.3000
4.5000
6.7000
8.9000

puts and '%':

[0.1, 2.3, 4.5, 6.7, 8.9].each { |x| puts "%0.04f" % x}
0.1000
2.3000
4.5000
6.7000
8.9000

For multidimensional arrays you need to decide in which order you iterate  
over the indices. There's more than one convention to do so. Typical order  
1: The inner loop iterates over the first, the next outermost loop over  
the second   index, and so on.
Typical order 2: The inner loop iterates over the last,  the next  
outermost loop over the previous index, and so on.

HTH,

Josef 'Jupp' Schugt
-- 
Blog: http://penpen.goodaddress.eu/
PGP key (id 6CC6574F): http://wwwkeys.de.pgp.net/
Jabber - http://www.jabber.org/ - contact information on request