這是我到目前爲止。如何返回多個值並將它們分配給可變變量?
let Swap (left : int , right : int) = (right, left)
let mutable x = 5
let mutable y = 10
let (newX, newY) = Swap(x, y) //<--this works
//none of these seem to work
//x, y <- Swap(x, y)
//(x, y) <- Swap(x, y)
//(x, y) <- Swap(x, y)
//do (x, y) = Swap(x, y)
//let (x, y) = Swap(x, y)
//do (x, y) <- Swap(x, y)
//let (x, y) <- Swap(x, y)
我正在學習Python和想象f怎樣酷#可能是,如果我們允許:'A,B < - b,a`,`x。[a],x。[b] < - x [b],x [a]`這樣`swap`就不再需要了。 – colinfang 2013-09-30 11:55:47