N
Nathan Oyama
Hi, I have a quick question: How can I increase a valuable by a certain
decimal (not an integer) in a for loop?
For example, in C,
for( i = 0; i < 0.5; i += 0.1 )
printf( "%f ", i );
the code above returns
0.0 0.1 0.2 0.3 0.4
How can I write this in Ruby?
Thanks,
Nathan
ps I looked in several Ruby tutorials, but couldn't find any example
using a decimal. . . Should I use another loop syntax like 'loop' or
'while/until'?
decimal (not an integer) in a for loop?
For example, in C,
for( i = 0; i < 0.5; i += 0.1 )
printf( "%f ", i );
the code above returns
0.0 0.1 0.2 0.3 0.4
How can I write this in Ruby?
Thanks,
Nathan
ps I looked in several Ruby tutorials, but couldn't find any example
using a decimal. . . Should I use another loop syntax like 'loop' or
'while/until'?