跳转至内容

Rebol 编程/swap

来自维基教科书,开放的书籍,开放的世界
SWAP series1 series2 

交换系列的元素。(修改)

SWAP 是一个函数值。

  • series1 -- (类型:系列)
  • series2 -- (类型:系列)

源代码

[编辑 | 编辑源代码]
swap: func [
    "Swaps elements of a series. (Modifies)" 
    series1 [series!] 
    series2 [series!]
][
    unless any [empty? series1 empty? series2] [
        poke series1 1 also pick series2 1 poke series2 1 pick series1 1
    ] 
    series1
]
华夏公益教科书