Comparison of programming languages (array)


This comparison of programming languages compares the features of array data structures or matrix processing for various computer programming languages.

Syntax

Array dimensions

The following list contains syntax examples of how to determine the dimensions.
Some languages index from zero. Some index from one. Some carry no such restriction, or even allow indexing by any enumerated type, not only integers.
LanguagesSizeFirstLast
Ada
ALGOL 68

etc.


etc.



etc.
APL
AWK
C#, Visual Basic, Windows PowerShell, F#
CFML
Ch
Common Lisp
D
Fortran
Go
Haskell
ISLISP
Icon
Cobra, D, Haxe, Java, JavaScript, Scala
J
JavaScript

Julia
Lingo
LiveCode

Lua
Mathematica

MATLAB, GNU Octave
Nim
Oberon
Object Pascal

Objective-C
OCaml
Perl
PHP
PL/I
Python
R
Raku@
Red
Ruby


Rust
S-Lang
Scheme
Smalltalk

Swift
Unicon
Visual Basic
Wolfram Language

Xojo
XPath/XQuery

Indexing

The following list contains syntax examples of how to access a single element of an array.
FormatLanguages
ALGOL 58, ALGOL 60, ALGOL 68, AWK, Julia, Modula, Pascal, Object Pascal, C#, S-Lang Icon, Unicon
or etc.
or or etc.
APL
ActionScript, C, CFML, Ch, Cobra, C++, D, Go, Haxe, Java, JavaScript, Lingo, Lua, Nim, Objective-C, Perl, PHP, Python, R, Ruby, Rust, Swift
Perl, Windows PowerShell, XPath/XQuery
Raku
or etc.Ada, ALGOL W, BASIC, COBOL, Fortran, RPG, GNU Octave, MATLAB, PL/I, Scala, Visual Basic, Visual Basic, Xojo
XPath/XQuery
OCaml
F#, OCaml
Red
Haskell
XPath/XQuery
Scheme
Common Lisp
ISLISP
Mathematica, Wolfram Language
Smalltalk
Objective-C

Slicing

The following list contains syntax examples of how a range of element of an array can be accessed.
In the following table:
  • – the index of the first element in the slice
  • – the index of the last element in the slice
  • – one more than the index of last element in the slice
  • the length of the slice
  • – the number of array elements in each
FormatLanguages
ALGOL 68, Julia, Icon, Unicon
APL
Python
Go
Pascal, Object Pascal, Delphi, Nim
Windows PowerShell
Perl
Ruby
Red
Ada
Fortran, GNU Octave, MATLAB
Mathematica, Wolfram Language
S-Lang
F#
Haxe, JavaScript, Scala
CFML
PHP
Common Lisp
ISLISP
OCaml
Objective-C

Array system cross-reference list

LanguageDefault
base index
Specifiable
index type
Specifiable
base index
Bound checkMultidimensionalDynamically-sizedVectorized operations
Adaindex typeyesyescheckedyesinitsome, others definable
ALGOL 681noyesvariesyesyesuser definable
APL1?0 or 1checkedyesyesyes
AWK1yes, implicitlynouncheckedyes, as delimited stringyes, rehashedno
BASIC0?nocheckednoinit?
C0nonouncheckedpartiallyinit, heapno
Ch0nonocheckedyes, also array of arrayinit, heapyes
C++0nonouncheckedyes, also array of arrayheapno
C#0nopartialcheckedyesheapyes
CFML1nonocheckedyes, also array of arrayyesno
COBOL1nonocheckedarray of arraynosome intrinsics
Cobra0nonocheckedarray of arrayheap?
Common Lisp0?nocheckedyesyesyes
D0yesnovariesyesyes?
F#0nopartialcheckedyesheapyes
FreeBASIC0noyescheckedyesinit, init?
Fortran1yesyesvariesyesyesyes
FoxPro1?nocheckedyesyes?
Go0nonocheckedarray of arraynono
Hack0yesyescheckedyesyesyes
Haskell0yesyescheckedyes, also array of arrayinit?
IDL0?nocheckedyesyesyes
ISLISP0?nocheckedyesinityes
J0?nocheckedyesyesyes
Java0nonocheckedarray of arrayinit?
JavaScript0nonocheckedarray of arrayyesyes
Julia1yesyeschecked yes, also array of arrayyesyes
Lingo1??uncheckedyesyesyes
Lua1?partialcheckedarray of arrayyes?
Mathematica1nonocheckedyesyesyes
MATLAB1?nocheckedyesyesyes
Nim0yesyesoptionalarray of arrayyesyes
Oberon0?nocheckedyesno?
Oberon-20?nocheckedyesyes?
Objective-C0nonocheckedarray of arrayyesno
OCaml0nonochecked by defaultarray of arrayinit?
Pascal, Object Pascalindex typeyesyesvariesyesvariessome
Perl0noyes checkedarray of arrayyesno
Raku0nonocheckedyesyesyes
PHP0yesyescheckedyesyesyes
PL/I1yesyesoptionalyesnoyes
Python0nonocheckedarray of arrayyesno
RPG1nono?nono?
R1?nouncheckedyes, also array of arrayyesyes
Ruby0nonocheckedarray of arrayyes?
Rust0nonocheckedarray of arrayno?
Sass1nonocheckedarray of arrayinit?
S-Lang0?nocheckedyesyesyes
Scala0nonocheckedarray of arrayinityes
Scheme0?nocheckedarray of arrayinityes
Smalltalk1?nocheckedarray of arrayyes?
Swift0nonocheckedarray of arrayyes?
Visual Basic 0, 1, or index typenoyescheckedyesyes?
Visual Basic 0 or index typenopartialcheckedyesyesyes
Wolfram Language1nonocheckedyesyesyes
Windows PowerShell0nonocheckedyesheap?
Xojo0nonocheckedyesyesno
XPath/XQuery1nonocheckedarray of arrayyesyes