CompareList

List command

Syntax

Compares two lists element by element, in order.

CompareList(<first>(), <second>() [, <flags>])

Parts

<first>The first list, with its parentheses.
<second>The second list, with its parentheses.
<flags>Optional. #AK_MATCH_EXACT (0, the default) or #AK_MATCH_FOLD_CASE to ignore the case of letters in strings.

Returns

1 when both lists have the same type, the same size and equal elements at every position, else 0.

Good to know

  • Records are compared field by field.
  • The current elements do not matter and do not move.
  • Any other <flags> value stops the program with "Unknown BASIC CompareList option".

Example

NewList a.string()NewList b.string()AddElement(a())a() = "Ada"AddElement(b())b() = "ADA"Console(Str(CompareList(a(), b())))   ' 0Console(Str(CompareList(a(), b(), #AK_MATCH_FOLD_CASE)))   ' 1
In the manual : Arrays, lists and maps