Difference between revisions of "Build a Loop"
From ArcoWiki
m (3 revisions imported) |
|
(No difference)
| |
Revision as of 17:15, 24 October 2017
Build a Loop is the technique to repeate a sequence of instructions a certain number of times based on an initial and limit value and a specified increment.
It is important to declare all the loop variables.
The generic statement is DO/ index variable, initial value, limit value, increment.
$$ Example of a Do Loop
DECL/INTGR,iDECL/CHAR,20,elnmDECL/DOUBLE,xx,yy,zz
$$ This is to create some dummy points.
F(POI_1)=FEAT/POINT,CART, 1.111,2.222,3.333, 0,0,0F(POI_2)=FEAT/POINT,CART, 4.444,5.555,6.666, 0,0,0F(POI_3)=FEAT/POINT,CART, 7.777,8.888,9.999, 0,0,0FA(POI_1)=FEAT/POINT,CART, 1.111,2.222,3.333, 0,0,0FA(POI_2)=FEAT/POINT,CART, 4.444,5.555,6.666, 0,0,0FA(POI_3)=FEAT/POINT,CART, 7.777,8.888,9.999, 0,0,0
$$ DO/ index variable, initial value, limit value, increment
DO/i,1,3,1$$ commands executed during each Do cycleelnm=ASSIGN/CONCAT('poi_',STR(i))xx=OBTAIN/FA(@elnm),3yy=OBTAIN/FA(@elnm),4zz=OBTAIN/FA(@elnm),5elnm=ASSIGN/CONCAT('newpoi_',STR(i))F(@elnm)=FEAT/POINT,CART, xx,yy,zz, 0,0,0FA(@elnm)=FEAT/POINT,CART, xx,yy,zz, 0,0,0
ENDDO