To use this website fully, you first need to accept the use of cookies. By agreeing to the use of cookies you consent to the use of functional cookies. For more information read this page.

Official ZPE Programming Environment documentationLists & arrays

Lists are a simple name for an array in ZPE. Unlike standard arrays in languages such as Java or C, they can expand as necessary. Version 1.6.7 finally added fixed size lists (arrays).

YASS
$a = [44, 32, 99]
print([4, 9, 3])
  

As of version 1.6.7 fixed size arrays are now possible:

YASS
$a = [0] * 4
print($a)
$b = ["Hello world"] * 3
print($b)
  

The previous example will add the number 0 four times to the first list and then add "Hello world" three times to the second list.

The difference between a list and an array (added in version 1.6.7) is that arrays have a fixed size whereas lists can be increased (or decreased) in size very easily. Arrays have the advantage of index existence, that is, one can be assured that such an index does exist.

Other languages use arrays and do not offer a list type and as a result, from an educational perspective, arrays are better suited as a teaching tool.

Comments

There are no comments on this page.

New comment
Reply
Provide feedback on this page
Comments are sent via email to me.