Xbasic

*array_ranged_assign Function

Syntax

V *ARRAY_RANGED_ASSIGN(C destination,C source)

Arguments

destination

The array to receive the copied elements.

source

The array to provide the elements to be copied.

Description

The *ARRAY_RANGE_ASSIGN() function copies a range of elements from one array to another. It performs a ranged array assignment, destinition to source, on array patterns passed in.

Example

dim arr.row[2] as P
dim arr.row[1].col[3] as P
dim arr.row[2].col[3] as P
arr.row[1].col[1].old = "one"
arr.row[1].col[2].old = "two"
arr.row[1].col[3].old = "three"
arr.row[2].col[1].old = "four"
arr.row[2].col[2].old = "five"
arr.row[2].col[3].old = "six"
*array_range_assign("arr.row[*].col[*].new", "arr.row[*].col[*].old")
? arr.row[1].col[1]
= new = "one"
old = "one"
? arr.row[1].col.dump_properties("new")
= one
two
three
? arr.row[2].col.dump_properties("new")
= four
five
six

Here is an example that uses an explicit row, not a wildcard.

*array_ranged_assign("arr.row[1].col[*].new", "arr.row[1].col[*].old")
? arr.row[2].col.dump_properties("new")
=

See Also