Jump to content

Array: Difference between revisions

m
changed REXX section header fence to match the others. -- ~~~~
m (→‎{{header|REXX}}: removed some blank lines. -- ~~~~)
m (changed REXX section header fence to match the others. -- ~~~~)
Line 28:
The lower bound of non-associative arrays in many [[:Category:Programming Languages|programming languages]] is commonly fixed at either 0 ([[C]] and relatives) or 1 (Old [[Fortran]] and relatives); or an arbitrary integer ([[Pascal]] and relatives, modern Fortran). In [[Ada]] any discrete type can used as an index. Zero-based indexing is best thought of in terms of the index being an offset from the beginning of the array. Thus the first element is located zero elements from this starting point. The alternative can be thought of as ordinal indexes referring to the first, second, ... and ''n''th elements of the array.
 
In most programming languages, arrays are accessed by using the array brackets <tt>[</tt> and <tt>]</tt>, e.g. in <tt>A[i]</tt>. However, exceptions exist, including [[RexxREXX]] which instead uses the dot operator <tt>.</tt>, such as in <tt>A.i</tt>; [[Fortran]], [[Ada]] and [[BASIC]] which use round parentheses <tt>A(i)</tt>, and in [[LISP|lisp]] dialects which use constructions like <tt>(ELT A n)</tt> for accessing and <tt>(SETA A n new_val)</tt> for setting (Interlisp) or <tt>(vector-ref A n)</tt> for accessing and <tt>(vector-set! A n new_val)</tt> for setting (Scheme). No bracket indexing occurs in [[J]], an array language; instead, the normal syntax of function creation and function calling applies.
 
==Computational metrics==
Line 54:
</lang>
 
==={{header|REXX}}===
<lang rexx>/*REXX program snipetts to show a variety (types) of "array" indexing. */
 
Cookies help us deliver our services. By using our services, you agree to our use of cookies.