@include <Array>

The Array class provides a simple array implementation in Bash++.

Methods

@Array.size

Scope: public

Echoes the number of elements in the array.

Usage: @Array.size

@Array.push

Scope: public

Adds a value to the end of the array.

Usage: @Array.push $value

Parameters

  • value
    • Type: primitive
    • The value to add to the array.

@Array.pop

Scope: public

Removes and echoes the last element of the array.

Usage: @Array.pop

@Array.insert

Scope: public

Inserts a value at a specific index in the array.

Usage: @Array.insert $index $value

Parameters

  • index
    • Type: primitive
    • The index at which to insert the value.
  • value
    • Type: primitive
    • The value to insert into the array.

@Array.remove

Scope: public

Removes the specified index from the array.

Usage: @Array.remove $index

Parameters

  • index
    • Type: primitive
    • The index of the value to remove.

@Array.at

Scope: public

Gets the value at a specific index.

Usage: @Array.at $index

Parameters

  • index
    • Type: primitive
    • The index of the value to retrieve.

@Array.front

Scope: public

Echoes the first element of the array.

Usage: @Array.front

@Array.back

Scope: public

Echoes the last element of the array.

Usage: @Array.back

@Array.all

Scope: public

Echoes all elements of the array.

Usage: @Array.all

@Array.empty

Scope: public

Echoes “true” if the array is empty, “false” otherwise.

Usage: @Array.empty

@Array.slice

Scope: public

Returns a slice of the array from start to end indices.

Usage: @Array.slice $start $end

Parameters

  • start
    • Type: primitive
    • The starting index of the slice (inclusive).
  • end
    • Type: primitive
    • The ending index of the slice (inclusive).

@Array.clear

Scope: public

Removes all elements from the array.

Usage: @Array.clear