1

I'm here starting to learn Lua, and I made a simple loop to understand this. It's supposed to print out 10-100 by seeing every number 1-100 that has a remainder of zero with modulus.

The code is as follows:

i=1
while i<=100
    do i = i+1
    if i%10 == 0 then
        print(i)
    end
end

I expect the output to be: 10 20 30 40 50 60 70 80 90 100

Instead, the output is this: 20 30 40 50 60 70 80 90 100 true

I have no idea why 10 isn't getting printed, and I have no real idea when i turned into "true". I'm using Lua 5.1 with SciTE. Thanks in advance.

2
  • 4
    The code appears to work in ideone, so I'm guessing it's a problem with SciTE. Commented Mar 11, 2012 at 6:05
  • 4
    The code works fine in the live demo. Commented Mar 11, 2012 at 10:35

1 Answer 1

0

This code works fine with ScITE and 5.1 for me.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.