Hi I have never noticed this before, but now it bothers me and I’d like to know the reasoning behind it.
When I run a loop like this:
+PROG TEMPLATE
loop#i 5
prt#i
endloop
prt#i
END
I get the following output.
1 +PROG TEMPLATE
2 $ Dat : C:\...\01_Teddy\SOFILOAD\Loads.dat (#001)
3 $ Job : PC97065:003385
4 LOOP#I 5
5 PRT#I
6 ENDLOOP
---- CADINT VARIABLE I ( 0) = 0.000
---- CADINT VARIABLE I ( 0) = 1.000
---- CADINT VARIABLE I ( 0) = 2.000
---- CADINT VARIABLE I ( 0) = 3.000
---- CADINT VARIABLE I ( 0) = 4.000
7 PRT#I
---- CADINT VARIABLE I ( 0) = 5.000
8 END
Why, does Sofistik add 1 to #i outside the loop?
If I run a similar piece of code in e.g. Python I get the following:
for i in range(5):
print(i)
print(i)
Output:
0
1
2
3
4
4
i.e. i is the same value outside the loop as it in inside the loop.
Soooo. Does anyone know why sofistik doing this counterintuitive addition?
Is it a bug or a feature?