[Swift-user] compile error

J A jamalphd at gmail.com
Thu Jan 28 12:55:07 CST 2010


This is one of the examples I dowlonaded from the swift website.




On Thu, Jan 28, 2010 at 11:29 AM, Michael Wilde <wilde at mcs.anl.gov> wrote:

> One thing I spot here is that this statement:
>
>  foreach string s, i in sa
>
> should be written:
>
>  foreach s, i in sa
>
> The foreach statement does not permit you to re-declare the types of the
> iteration variables (s and i in your case).
>
> - Mike
>
>
> ----- Original Message -----
> From: "J A" <jamalphd at gmail.com>
> To: swift-user at ci.uchicago.edu
> Sent: Thursday, January 28, 2010 10:11:36 AM GMT -06:00 US/Canada Central
> Subject: [Swift-user] compile error
>
>
>
> Hi:
>
> When I try to run the following code:
>
> array_iteration.swift:
>
>
> type file {}
> (file f) echo (string s) {
> app {
> echo s stdout=@filename(f );
> }
> }
> (file fa[]) echo_batch (string sa[]) {
> foreach string s, i in sa {
> fa[i] = echo(s);
> }
> }
> string sa[] = ["hello","hi there","how are you"];
> file fa[];
> fa = echo_batch(sa);
>
> ......
>
> I get the following error:
>
> Could not compile SwiftScript source: line 10:13: expecting an identifier,
> found 'string'
>
>
> any idea on how to fix it?
>
>
> Thanks,
> Jamal
>
>
> _______________________________________________
> Swift-user mailing list
> Swift-user at ci.uchicago.edu
> http://mail.ci.uchicago.edu/mailman/listinfo/swift-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-user/attachments/20100128/1f6e24d4/attachment.html>


More information about the Swift-user mailing list