# \$: Index to Facilitate Array and String Operations

### When working with arrays or strings \$ is the left-hand side linear array index for InlineLoop use.

• When working with Arrays \$ is the left-hand side linear array index for InlineLoop use
• The (global) variable \$ is initially set to 1 when a script line is executed
• The loop terminates at array end or any other error condition
• The operation array = F(\$, ...) is equivalent to
• DO \$ = 1, len_array
•     array(\$) = F(\$, ...)
• ENDDO
• = f(element index):
• vector = \$ ! evaluates to vector = (1,2,3,4,....)
• vector = (\$ - 1) * 1.001 ! set vector to (0.000, 1.001, 2.002, 3.003, ...)
• ( execution sequence is \$ = 1, 2, 3, ... )
• REAL :: factorials(n)
• factorials = *(1:\$) ! factorials set to (1, 2, 6, 24, 120, ..., n! )
• factorial = *(1:n) ! == n!
• \$ operations:
 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
• vec = mtx(\$, \$)
• vec = mtx(\$, \$+1)
• vec = mtx(\$+1, \$)
 1 6 11 16 * * ... 2 7 12 * * * ... 5 10 15 * * * ...
(* marked elements of vec are out of the \$ loop scope, and will not be changed)
• :
• REAL :: n=33, matrix(n, n)
• matrix = MOD(\$, n+1) == 1
• matrix = \$R == \$C ! same result, less code
• in expressions like string = F(\$, ...), e.g:
• sets sample_string to "ABCDEFGHIJKLMNOPQRST"
• sample_string = "+"(\$ == \$) ! \$ to force InlineLoop to execute LEN(sample_string) times, (\$==\$) is always = 1
sets sample_string to "++++++++++++++++++++"
• sample_string(10*\$ -9 : 10*\$) = "....+...." // CHAR(48+\$)
sets sample_string to "....+....1....+....2"

Support HicEst   ⇾ Impressum