[Swift-user] import position in swift script

Mihael Hategan hategan at mcs.anl.gov
Thu Jun 18 12:47:53 CDT 2015


Hi,

Yes. Imports must come before other types of statements.

Mihael

On Thu, 2015-06-18 at 17:20 +0000, Max Hutchinson wrote:
> Do all import statements need to come before executable statements?
> 
> I have two scripts: defs.swift and run.swift.  If run.swift starts with
> import "defs";
> then everything works fine.  If instead defs.swift ends with
> import "run";
> I get this error:
> Swift trunk git-rev: 1d512cbda070d363e8ec3cf16e77dfcddc6e66cb heads/master
> 6377
> RunID: run011
> Could not compile SwiftScript source: line 24:12: unexpected token: ;
> where line 24 is:
> int foo = 1;
> 
> Thanks,
> Max
> _______________________________________________
> Swift-user mailing list
> Swift-user at ci.uchicago.edu
> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user





More information about the Swift-user mailing list