Cancel
Showing results for 
Search instead for 
Did you mean: 

Bug: i += 1?

Pioneer
Pioneer

Hi,

 

Im working currently with Plant Simulation version 13.

months ago I used i += 1 instead of i = i + 1. But since yesterday when I used i += 1, Plant Simulation understood i = i + 2. Today I try it again, but nothing changes. 

Anybody like me? 

Or it happens only with me? 

My code:

for var i := 1 to table.YDIm
            if table["side",i] = "left"
                 if i = 1
                       table["path",i].A.createSensor((table["length",i]), "length", "m_controlSensor", true, false, VOID, true, false )
                else
                       if table["length",i] /= table["length",i-1]
                       table["path",i].A.createSensor((table["length",i]), "length", "m_controlSensor", true, false, VOID, true, false )
                      end
                end
         else
                debug
        end
i += 1
next

 Sorry for my dumb question. 

 

Thanks

5 REPLIES

Re: Bug: i += 1?

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi Elisha,

 

can you post the surrounding code?

Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution

Re: Bug: i += 1?

Pioneer
Pioneer
for var i := 1 to table.YDIm
if table["side",i] = "left"
if i = 1
table["path",i].A.createSensor((table["length",i]), "length", "m_controlSensor", true, false, VOID, true, false )
else
if table["length",i] /= table["length",i-1]
table["path",i].A.createSensor((table["length",i]), "length", "m_controlSensor", true, false, VOID, true, false )
end
end
else
debug
end
i += 1
next

Re: Bug: i += 1?

Pioneer
Pioneer
I have to use i += 0. It works like i = i + 1.

Re: Bug: i += 1?

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor
do you know, that the for loop automatically increments the variable i after each loop ?
The row i+=1 is not necessary.
Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: Bug: i = 1?

Pioneer
Pioneer
oh. I didnt know it before. Thank you.