|
# More iteration tests (no graph output)
#
print "\ndynamic reevaluation of numeric iteration limits"
array J[3] = [ 1, 4, 3 ]
print "\nJ =",J
Output = ""
print "do for [i=1:3] for [j=J[i]:3] { save(i,j) }"
do for [i=1:3] for [j=J[i]:3] { Output = Output . sprintf("%d-%d ",i,j) }
print Output
array J[3] = [ 4, 1, 3 ]
print "\nJ =",J
Output = ""
print "do for [i=1:3] for [j=J[i]:3] { save(i,j) }"
do for [i=1:3] for [j=J[i]:3] { Output = Output . sprintf("%d-%d ",i,j) }
print Output
print ""
Output = ""
print "do for [i=1:4] for [k=i:i] for [j=1:k] { save(i,j) }"
do for [i=1:4] for [k=i:i] for [j=1:k] { Output = Output . sprintf("%d-%d ",i,j) }
print Output
print "\ndynamic reevaluation of iteration string"
array A[3] = [ "a b", "", "d" ]
print "A = ", A
print 'do for [ i = 1:|A| ] { do for [ j in A[i]] { print "".i.": ".j }}'
Output = ""
do for [ i = 1:|A| ] { do for [ j in A[i]] { Output = Output." ".i.": ".j }}
print Output
print 'do for [ i = 1:|A| ] for [ j in A[i]] { print "".i.": ".j }'
Output = ""
do for [ i = 1:|A| ] for [ j in A[i]] { Output = Output." ".i.": ".j }
print Output
|