x = 1 while true do x = x + 1 print(x) sleep(1) endall it does is print "1", any fix?
problem with 'x = x + 1'
Started by Agent Silence, May 12 2014 08:50 PM
4 replies to this topic
#1
Posted 12 May 2014 - 08:50 PM
#2
Posted 12 May 2014 - 09:16 PM
Are you sure you don't mean something like:
Because the code you have above should increment just fine.
x = 0 while true do local x = x + 1 print(x) sleep(1) end
Because the code you have above should increment just fine.
#3
Posted 12 May 2014 - 09:54 PM
I think its actually this:
[Edit] Because don't you got to set a variable before you do the arithmetic part?
local x = 0 while true do x = x + 1 print(x) sleep(1) end
[Edit] Because don't you got to set a variable before you do the arithmetic part?
Edited by cptdeath58, 12 May 2014 - 09:56 PM.
#4
Posted 12 May 2014 - 11:53 PM
Your code would work fine, as does his original code. The code I posted above is the only close variant I can think of that would exhibit the symptoms he describes.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












