Edit

kc3-lang/kc3/doc/1_KC3/1.02_Array.en.md

Branch :

  • doc/1_KC3/1.02_Array.en.md
  • # 1.2 Array
    
    Arrays have an array type and are multidimensional like in C.
    
    Litteral values start with an array cast and are followed by a tuple.
    
    Use `List.to_array` to convert a `List` to an array type.
    
    ## 1.2.1 Examples
    
    ```
    ikc3> a = (U8[]) {0, 1, 2}
    (U8[]) {0, 1, 2}
    ikc3> type(a)
    U8[]
    ikc3> a[0]
    0
    ikc3> a[1]
    1
    ikc3> a[2]
    2
    ikc3> List.to_array
    cfn Array "kc3_list_to_array" (List, Sym, Result)
    ikc3> List.to_array([0, 1, 2], U8[])
    (U8[]) {0, 1, 2}
    ```
    
    ---
    
    Top : [KC3 documentation](../)
    
    Previous : [1.01 Introduction](1.01_Introduction)
    
    Next : [1.03 Block](1.03_Block)