As far as I know in Case 1 phor is an index variable that starts at one and is incremented by one for each next string in the list of strings. In the example there are three strings in the list
("0", "1" and "2"), so phor takes the values 1, 2 and 3.
In case 2, phor is a scalar that starts at 0 and is incremented until it eventually reaches 2, so it takes the values 0, 1 and 2.
So, no the results are not identical.
Best regards,
Jan Annaert
Dear Gretl Community,
I would like to know what is wrong in the
following loops (Case 1 and Case 2):
# Case 1
loop foreach phor 0 1 2 --quiet
loop i = 1..2 --quiet
loop j = phor+1..phor+2 --quiet
scalar TESTE = $j
print TESTE
endloop
endloop
endloop
# Case 2
loop phor = 0..2 --quiet
loop i = 1..2 --quiet
loop j = phor+1..phor+2 --quiet
scalar TESTE = $j
print TESTE
endloop
endloop
endloop
As much as I know, they should present the
same result. Am I wrong?
Best regards,
Henrique Andrade