[Swift-user] compile error
Michael Wilde
wilde at mcs.anl.gov
Thu Jan 28 10:29:35 CST 2010
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
More information about the Swift-user
mailing list