[Swift-devel] Swift user guide

Ben Clifford benc at hawaga.org.uk
Mon Mar 2 09:43:50 CST 2009


On Mon, 2 Mar 2009, Ian Foster wrote:

> Ben:
> 
> The example I saw in the code had the input array (e.g., "a", in "foreach v in
> a") constructed elsewhere in the program, with a[0] = v1, a[1] = v2. That
> seemed particularly challenging.

You can have single assignment with an explicit list of array contents 
like this:

a = [v1, v2];

That works in the present implementation in some, but not all, cases - it 
depends on whethere the expressions v1 and v2 are primitive types like int 
(in which case it does work, and has worked since before Swift was called 
Swift) or if they are mapped to files (in which case it doesn't work in 
the present implementation, but could be made to).

-- 



More information about the Swift-devel mailing list