Insert Command

Purpose

Inserts a numeric or a string expression at the specified place in a one-dimensional array of corresponding variable type.

Syntax

Insert x(m) [=y]

y:aexp, if x() is a numeric array or sexp, if x() is a string array
x():a one-dimensional array of any type

Description

Insert x(m)=y inserts y in array x() at position m. In other words all items in array x() whose indices are greater than or equal to m are moved one position down. The last element in x() is deleted with each Insert.

Insert x(m) inserts an empty element at position m.

Example

OpenW # 1

Dim a$(4), i%

a$(1) = "String #1"

a$(2) = "String #2"

a$(3) = "String #3"

a$(4) = "String #4"

Insert a$(3) = "New String"

For i% = 1 To 4

Print a$(i%)

Next i%

// prints

// String #1

// String #2

// New String

// String #3

See Also

Delete

{Created by Sjouke Hamstra; Last updated: 10/10/2014 by James Gaite}