• Kipper

    v0.12.1
  • Downloads

  • Docs

  • Playground

  • Changelog

  • Kipper

    v0.12.1
    • Downloads

    • Docs

    • Playground

    • Changelog

      • 0.11.0 /
      • Datatypes /
      • Array Type
    Kipper Docs
    • next
    • latest
    • 0.11.0
    • 0.10.4
    • 0.9.2
    • Overview

    • Quickstart

    • Goals for Kipper

    • Supported platforms

    • Usage Examples

      • Overview

      • Compiler Setup

        • Overview

          • index

          • compiler

          • errors

          • logger

          • utils

          • config

          • index

          • index

        • Overview

        • new

        • run

        • compile

        • help

        • version

    • Variables

      • Overview

      • String Type

      • Number Type

      • Boolean Type

      • Void Type

      • Null Type

      • Undefined Type

      • Array Type

      • Overview

      • Arithmetic Expression

      • Assignment Expression

      • Conditional Expressions

      • Logical Expressions

      • Bitwise Expression

      • Relational Expressions

      • Convert Expression

      • F-String Expression

      • Member Access Expression

      • Function Call Expression

      • Overview

      • Expression Statement

      • If Statement

      • While Loop

      • Do-While Loop

      • For Loop

      • Compound Statement

      • Jump Statement

    • Functions

    • Comments

    • Built-in Functions

      • 0.11.0 /
      • Datatypes /
      • Array Type
    • 0.11.0 /
    • Datatypes /
    • Array Type

    Edit page

    Array Type - Array<T>

    Scheduled for release in Kipper v0.12.0

    The Array<T> data type is a unique data type, as it does not represent itself a value, but rather a sequence of multiple values. As a result of that an array has also a length and an index for each item, which you may use to access them using the following syntax:

    Array Indexing Syntax

    VAR[INDEX];

    Examples

    Simple constant array definition

    var var24: Array<num> = [2, 3, 4];

    Accessing elements of an array

    var var25: Array<num> = [2, 3, 4];
    var item_of_list: num = var26[2]; // -> 4

    Calling len function on an array

    var len_of_list: num = len(var26); // -> 3

    Calling last function on an array

    var len_of_list: num = last(var26); // -> 4

    Calling first function on an array

    // ✓ Accessing the first item of the list using 'first()'
    var len_of_list: num = first(var26); // -> 2

    X May not set a list to a single value

    var var26: Array<num> = 2;

    X May not set item of list to an invalid type

    var var27: Array<num> = ["string"];

    X May not convert list to another type as a whole

    var var28: Array<str> = ["99", "1893", "4"];
    var var29: Array<num> = var27 as Array<num>; // -> Invalid conversion
  • Developed at and supported by:

    • Releases
    • GitHub
    • Security
    • Issue Tracker
    • License
  • Copyright © 2021-2025 Luna Klatzer, Lorenz Holzbauer & Fabian Baitura.
    Kipper is licensed under the GPL-3.0-or-later license.