_____ |
acmp ( ) |
Syntax |
|
Function |
- _____This
compares numerical value array variables with each other, and
then returns with an integer whether they match or not. In a
case where array variable 1 is greater, it returns 1; in a case
where array variable 2 is greater, it returns -1; and in a case
where array variable 1 and array variable 2 match, it returns
0.
- _____The
comparison is carried out in order from the nth element "(beginning,
0)" of "start expression 1" of "array variable
1" and the nth element "(beginning, 0)" of "start
expression 2" of "array variable 2." As long as
the contents of the array variables match, the comparison will
continue, but in a case of length expression > 0, it will
compare up to the extent of the element number shown in the length
expression, and if they match, it will return 0. Moreover, also
in a case where either array variable reaches the end, 0 returns.
In the end, what is actually compared are just the shortest numbers
among the length expression, the element numbers following start
expression 1 of array variable 1, and the element numbers following
start expression 2 of array variable 2 (in a case where the length
expression is 0, the shortest of the element numbers following
start expression 1 of array variable 1 and the element numbers
following start expression 2 of array variable 2).
- _____For
example, in the case of VARIABLE Array1 [20], Array2 [20], acmp (Array1, 5, Array2, 10, 0) comes to compare
Array1 [5:10] and Array2 [10:10] by combining with the element
number of Array2. With acmp (Array1, 5, Array2 10, 5), it will come to
compare Array1 [5:5] and Array2 [10:5] by combining with the
length expression. With acmp (Array1, 15, Array2 5, 10), it will come to
compare Array1 [15:5] and Array2 [5:5] by combining with the
element number of Array1.
- _____As
a word of caution, when it's VARIABLE Array1 [20], Array2 [20], acmp (Array1, 15, Array2, 5, 10) compares Array1
[15:5] and Array2 [5:5], but if even Array1 [15:5] and Array2
[5:5] match, the function ignores the remaining part of Array2
and returns 0. When Array2 is larger, it will not make a judgment
and return -1.
- _____
Argument |
Return Value |
Refer to explanation |
Integer/illegal value |
|
Errors that Occur at Startup Time |
- Please specify the integer item
- A floating point number, character
string, segment, etc., has been specified in start expression
1, start expression 2, or the length expression.
|
- Please specify the numerical value array
- What can be specified in array variable
1 and array variable 2 are byte, character, integer, and floating
point number arrays only.
|
- Errors that Occur During Execution (only in the case of
DEBUG 1; refer to p. 39)
|
- There was an illegal argument in the built-in function
- A floating point number, character
string, segment, etc., has been specified in start expression
1, start expression 2, or the length expression. Please
specify an integer.
- Moreover, in a case where start expression
1, start expression 2, or the length expression are negative;
or in a case a case where start expression 1 or start expression
2 are above the element number of an array variable, this error
also occurs. Please specify with 0 or a positive for start expression
1, start expression 2, or the length expression.
- Please confirm also whether the types
of array variable 1 and array variable 2 are the same (refer
to ' :
', p. 52), and whether you have specified byte, character, integer,
or floating point number arrays.
|
- There was an illegal reference to
a state name
- A segment has been specified in array variable 1 or array
variable 2. What can be specified in array variables are are byte, character, integer, and floating point
number arrays only.
|
Errors Where an Illegal Value Is Returned |
- Case where start expression 1, start expression 2, or
the length expression are incorrect
- Please specify 0 or a positive integer
in start expression 1, start expression 2, or the length expression.
|
- Case of a start expression being above the element number
of the array variable
- Please specify a value less than the
element number of the array variable in the start expression.
|
- Case of array variable 1 and array variable 2 not being
the same type of numerical value array
- Please specify the same type of array,
whether byte, character, integer, or floating point number, in
array variable 1 and array variable 2.
|
Translator's Note |
- The translator had some difficulty understanding this function,
and thus he contacted Personal Media for a further explanation.
Here is their reply.
- _____
- The "length expression" is the length to be compared
in the case of acmp, and
the length to be copied in the case of acopy.
- _____
- (Ex.) In the case of acmp (a,
20, b, 30, 10), it compares:
- _____
- a[20] and b[30], a[21] and b[31], a[22] and b[32], a[23]
and b[33], a[24] and b[34],
a[25] and b[35], a[26] and b[36], a[27] and b[37], a[28] and
b[38], a[29] and b[39]
- _____
- However, in a case where you have specified 0 in the "length
expression," it will compare until the end of the arrays.
- _____
- (Ex.) In the case where the number of elements in arrays
c and d is 5, acmp (c, 0,
d, 0, 0) compares:
- _____
- c[0] and d[0], c[1] and d[1], c[2] and d[2], c[3] and d[3],
c[4] and d[4]
- _____
- In other words, in a case where the number of elements in
arrays c and d is 5, acmp
(c, 0, d, 0, 0) and acmp
(c, 0, d, 0, 5) mean the same thing.
- _____
- As for the length of the arrays, Personal Media stated:
- _____
- In a case where you have specified an array with A[20], there
are 20 elements in the array. These are: A[0], . . . , A[19].
|
198, 199 |