[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: noobie question about numeric for
- From: fra III <ilterzouomo@...>
- Date: Tue, 27 Mar 2012 11:40:04 +0200
Hello All,
i am a lua user although not a real programmer so probably my questions
will be really basics, and i apologies for this.
Anyway my question is: why this two iterators are different?
iter = 0
for x=0.0, 1.0, 0.1 do
iter = iter + 1
end
print(iter) --> 11
iter = 0
for x=1.0, 2.0, 0.1 do
iter = iter + 1
end
print(iter) --> 10
the first include last value (1.0), while the second not.
the first example work like when using any integer step
(i.e. for i=start, end, integer).
I would like to understand why that happens.
Thanks in advance,
ciao,
francesco.