[Swift-user] array append

Bronevetsky, Greg bronevetsky1 at llnl.gov
Thu Feb 27 18:31:40 CST 2014


I'm trying to use the array append function in Swift 0.94.1, based on Section 2.3 of the user guide (http://swift-lang.org/guides/release-0.94/userguide/userguide.html)

Given the following program:
int[auto] array;

foreach i in [1:100] {
  append(array, i * 2);
}

I run swift on it and get this following error:
> swift test.swift
Could not start execution
        Compile error in foreach statement at line 3
        Compile error in procedure invocation at line 4
        Procedure append is not declared.

How should I be using the append function to avoid this error? Thank you!

Greg Bronevetsky
Lawrence Livermore National Lab
(925) 424-5756
bronevetsky at llnl.gov<mailto:bronevetsky at llnl.gov>
http://greg.bronevetsky.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-user/attachments/20140228/95720cf6/attachment.html>


More information about the Swift-user mailing list