summary refs log tree commit diff stats
path: root/tests/accept/run/tarray2.nim
blob: 048f51795c54128f9cce5632938f06d3f5e8a9dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
discard """
  file: "tarray2.nim"
  output: "[16, 25, 36]"
"""
# simple check for one dimensional arrays

type
  TMyArray = array[0..2, int]

proc mul(a, b: TMyarray): TMyArray =
  result = a
  for i in 0..len(a)-1:
    result[i] = a[i] * b[i]

var
  x, y, z: TMyArray
 
x = [ 4, 5, 6 ]
y = x
echo repr(mul(x, y))

#OUT [16, 25, 36]