Difference between revisions of "Build a Loop"
From ArcoWiki
m (3 revisions imported) |
m (The LinkTitles extension automatically added links to existing pages (<a rel="nofollow" class="external free" href="https://github.com/bovender/LinkTitles">https://github.com/bovender/LinkTitles</a>).) |
||
Line 1: | Line 1: | ||
'''[[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.<br/> | '''[[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.<br/> | ||
− | It is important to declare all the loop variables.<br/> | + | It is important to declare all the loop [[variables]].<br/> |
The generic statement is <code>DO/ index variable, initial value, limit value, increment</code>.<br/> | The generic statement is <code>DO/ index variable, initial value, limit value, increment</code>.<br/> | ||
Revision as of 14:13, 23 March 2018
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,i
DECL/CHAR,20,elnm
DECL/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,0
F(POI_2)=FEAT/POINT,CART, 4.444,5.555,6.666, 0,0,0
F(POI_3)=FEAT/POINT,CART, 7.777,8.888,9.999, 0,0,0
FA(POI_1)=FEAT/POINT,CART, 1.111,2.222,3.333, 0,0,0
FA(POI_2)=FEAT/POINT,CART, 4.444,5.555,6.666, 0,0,0
FA(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 cycle
elnm=ASSIGN/CONCAT('poi_',STR(i))
xx=OBTAIN/FA(@elnm),3
yy=OBTAIN/FA(@elnm),4
zz=OBTAIN/FA(@elnm),5
elnm=ASSIGN/CONCAT('newpoi_',STR(i))
F(@elnm)=FEAT/POINT,CART, xx,yy,zz, 0,0,0
FA(@elnm)=FEAT/POINT,CART, xx,yy,zz, 0,0,0
ENDDO