array.get() - Retrieve Element from Array

This section describes array.get() function that retrieves the element from an array at a given location.

array.get() function is provided to retrieve the element of a given location using the following syntax:

array.get(a, i)

Parameters:
   a - A "array" data object.
   i - A "integer" data object.

Return: 
   Returns the data object from "a" at the location of "i".
   Location zero, 0, is the first element of the array. 
   
Errors:
   Throws "IndexOutOfBound" error code, if the given integer 
   points to a location outside of the range of array element index.

Examples of how to use string.get() function:

array.get([1, "Two", 3], 1); # Returns "Two"

y = array([1, "Two", 3]); 
array.get(y, 1); # Returns "Two"

array.get(y, 3); # Gets the "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