VFP problem, n = 10 s = 0 for k = n-8 to N-9 s = S + k n = n-1 endfor s return, I don't understand k = n-8 to N-9, who can help me understand

VFP problem, n = 10 s = 0 for k = n-8 to N-9 s = S + k n = n-1 endfor s return, I don't understand k = n-8 to N-9, who can help me understand


N=10
S=0
For k = n-8 to N-9 & & equivalent to for k = 2 to 1, the next two lines will not execute to
S = S + K & & will not execute
N = n-1 & & will not execute
ENDFOR
The value of S & & S is still 0
RETURN



dimension a (3) s=0 for k=1 to 3 a(k)=3-k s=s+k endfor a(1),a(2),a(3),s


so easy .first ,we move on to k.If k equals 1,then we have a(1)=3-1=2.Thus S=0+k=0+1=1next,again,we continue this process ,which we have a(2)=3-2=1.And S=1+2=3.Finally,if k is 3,we will get a(3)=3-3=0...



In VFP, clear s = 0 for n = 1 to 10 s = S + n n = n + 1 endfor s


Find the sum of 1 to 10, and finally find s = 45