array.subArray() - Sub-Array Function

This section describes Sub-Array Function - array.subArray()

The array.subArray() function is defined in the following syntax:

array.subArray(a, i, l)

Parameters:
   a - An "array" data object
   i - An "integer" data object
   l - An "integer" data object
   
Return: 
   Returns a new "array" data object of "l" elements 
   representing a portion of the given array 
   starting from location "i".
   
Errors:
   Throws the "IndexOutOfBound" error, if given "i" and "l" 
   are referring to locations out of the element range of "a".

Examples of how to use array.subArray() function:

array.subArray([1, "Two", 3], 1, 2); # returns ["Two",3]
array.subArray([1, "Two", 3], 1, 3); # returns "IndexOutOfBound" error

Last update: 2017.

Table of Contents

 About This Book

 Introduction of H Language

 Syntax

 Data Types

 Variables

 Expressions

 Statements

 "boolean" Data Type

 "integer" Data Type

 "string" Data Type

 "real" Data Type

"array" Data Type

 What Is "array" Data Type

 "array" Literals

 Constructor Function: array()

 array.get() - Retrieve Element from Array

 x[i] - Array Element Format for array.get()

 array.set() - Update Element of Array

 x[i] - Array Element Format for array.set()

 "array" "add" Operation

array.subArray() - Sub-Array Function

 Source Code Packages

 Classes and Objects

 Object Oriented Programming

 Inheritance - Object Attachments

 Encapsulation - Private Members

 References

 PDF Printing Version