mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-06 11:54:11 +00:00
fixes #6631
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
discard """
|
||||
output: '''@[2, 3, 4]321
|
||||
9.0 4.0'''
|
||||
9.0 4.0
|
||||
3
|
||||
@[(Field0: 1, Field1: 2), (Field0: 3, Field1: 5)]
|
||||
2
|
||||
@[a, new one, c]'''
|
||||
"""
|
||||
|
||||
proc foo[T](x, y: T): T = x
|
||||
@@ -11,3 +15,23 @@ echo a[1.. ^1], a[^2], a[^3], a[^4]
|
||||
echo b[^1][^1], " ", (b[^2]).foo(b[^1])[^1]
|
||||
|
||||
b[^1] = [8.8, 8.9]
|
||||
|
||||
var c: seq[(int, int)] = @[(1,2), (3,4)]
|
||||
|
||||
proc takeA(x: ptr int) = echo x[]
|
||||
|
||||
takeA(addr c[^1][0])
|
||||
c[^1][1] = 5
|
||||
echo c
|
||||
|
||||
proc useOpenarray(x: openArray[int]) =
|
||||
echo x[^2]
|
||||
|
||||
proc mutOpenarray(x: var openArray[string]) =
|
||||
x[^2] = "new one"
|
||||
|
||||
useOpenarray([1, 2, 3])
|
||||
|
||||
var z = @["a", "b", "c"]
|
||||
mutOpenarray(z)
|
||||
echo z
|
||||
|
||||
Reference in New Issue
Block a user