$ArrSize: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (Mlarocca moved page $Arrsize to $ArrSize: Change S to upper case)
No edit summary
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<p>The $Arrsize function returns the number of elements in a particular dimension of a named array. This function is useful for users who pass entire arrays as parameters to a subroutine and then must know the size of the array supplied as the actual argument. For more information about passing arrays to a subroutine, refer to [[Flow of control in User Language#Index loops|Index loops]]. </p>
<p>The $ArrSize function returns the number of elements in a particular dimension of a named [[Using_variables_and_values_in_computation#.25Variable_arrays|array]]. This function is useful for users who pass entire arrays as parameters to a [[Subroutines|subroutine]] and then must know the size of the array supplied as the actual argument. For more information about passing arrays to a subroutine, refer to [[Flow of control in User Language#Index loops|Index loops]]. </p>
<b>Syntax</b>
<b>Syntax</b>
<p>The format of the $Arrsize function is:</p>
<p>The format of the $ArrSize function is:</p>
<p class="code">$Arrsize (name, dimension)  
<p class="code">$ArrSize (name, dimension)  
</p>
</p>
<p>where:</p>
<p>where:</p>
<ul>
<ul>
<li>name is a string that specifies the name of an array.</li>
<li>name is a quoted string that specifies the name of an array.</li>
</li>
</li>
<li>dimension is a number that indicates the dimension of the named array for which the number of elements should be returned. Dimension can contain an expression whose value is 1, 2, or 3. </li>
<li>dimension is a number that indicates the dimension of the named array for which the number of elements should be returned. Dimension can contain an expression whose value is 1, 2, or 3. </li>
Line 14: Line 14:
<p class="code">FOR %I FROM 1 TO $arrsize ('%COMM.ARRAY',1)  
<p class="code">FOR %I FROM 1 TO $arrsize ('%COMM.ARRAY',1)  
</p>
</p>
<p>causes %I to iterate from 1 to the number of elements in dimension 1 of the array %COMM.ARRAY. </p>
<p>causes %I to iterate from 1 to the number of elements in dimension 1 of the array %COMM.ARRAY.  
</p>
<p>Note: The first argument (name) will always be upper cased unless the compiler directive SIRIUS CASE LEAVE is specified prior to the $function (version 78 and above).
</p>
 


[[Category:SOUL $functions]]
[[Category:SOUL $functions]]

Latest revision as of 20:43, 11 January 2018

The $ArrSize function returns the number of elements in a particular dimension of a named array. This function is useful for users who pass entire arrays as parameters to a subroutine and then must know the size of the array supplied as the actual argument. For more information about passing arrays to a subroutine, refer to Index loops.

Syntax

The format of the $ArrSize function is:

$ArrSize (name, dimension)

where:

  • name is a quoted string that specifies the name of an array.
  • dimension is a number that indicates the dimension of the named array for which the number of elements should be returned. Dimension can contain an expression whose value is 1, 2, or 3.

Example

FOR %I FROM 1 TO $arrsize ('%COMM.ARRAY',1)

causes %I to iterate from 1 to the number of elements in dimension 1 of the array %COMM.ARRAY.

Note: The first argument (name) will always be upper cased unless the compiler directive SIRIUS CASE LEAVE is specified prior to the $function (version 78 and above).