$Arr Init: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
mNo edit summary
Line 2: Line 2:
<span class="pageSubtitle"><section begin="desc" />Initialize every element of array to specific value<section end="desc" /></span>
<span class="pageSubtitle"><section begin="desc" />Initialize every element of array to specific value<section end="desc" /></span>


<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Arr_Init function is [[to be entered]].</p>
<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is no direct OO equivalent for the $Arr_Init function because the OO methods emphasize the use of [[Collections]] over the use of arrays.</p>


$Arr_Init can be used to initialize every element of an array to a specific value. $Arr_Init accepts two arguments and returns a numeric code.  
$Arr_Init can be used to initialize every element of an array to a specific value. $Arr_Init accepts two arguments and returns a numeric code.  

Revision as of 15:53, 31 January 2011

<section begin="desc" />Initialize every element of array to specific value<section end="desc" />

Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is no direct OO equivalent for the $Arr_Init function because the OO methods emphasize the use of Collections over the use of arrays.

$Arr_Init can be used to initialize every element of an array to a specific value. $Arr_Init accepts two arguments and returns a numeric code.

The first argument is an array of string, float, or fixed values. This array can be a single or multi-dimensional array and must not be an array in an image.

The second argument is the value with which the array is to be initialized. If this argument is not specified, it defaults to a null string if the first argument is a string array and 0 if the first argument is either a fixed or float array.

Syntax

<section begin="syntax" /> %RESULT = $Arr_Init (array, value) <section end="syntax" />

$Arr_Init Function

%RESULT returns a 0 or, if the array is invalid, a -1.


In the following example

%FXARRAY IS FIXED ARRAY(5) %RC = $Arr_Init(%FXARRAY)

every element of %FXARRAY is set to 0.

In the following example

%STARRAY IS STRING LEN 20 ARRAY(5) %RC = $Arr_Init(%STARRAY, '*** UNKNOWN ***')

every element of %STARRAY is set to '*** UNKNOWN ***'.

Products authorizing $Arr_Init