2026a

# prepend!


在向量前端添加元素

# 语法

prepend!(a::Vector, collections...)

# 说明

prepend!(a::Vector, collections...) 在向量 a 的前端插入集合 collections 的元素。 示例

# 示例

在向量前端添加元素
prepend!([3], [1, 2])
ans = 3-element Vector{Int64}:
1
2
3
prepend!([6], [1, 2], [3, 4, 5])
ans = 6-element Vector{Int64}:
1
2
3
4
5
6

# 输入参数

collection - 集合

任意集合,指定为向量、矩阵、元组等。

# 另请参阅

append!