Import Declarations
The import statement is used to import declarations from other packages. Import statements must be placed after the package declaration and before any other code.
Cangjie provides multiple import methods: import std.collection.ArrayList imports a single type, while import std.collection.* imports all visible declarations from the package. Choosing the appropriate import method makes code clearer.
Notably, the std.core package is automatically implicitly imported, so basic types like String, Array, Int64, etc. can be used directly without manual import. This differs from some languages that require explicit imports for all types.
The code on the right demonstrates importing ArrayList and the sqrt function. Note that these features from the standard library require explicit import.
Try changing import std.collection.ArrayList to import std.collection.* and observe whether the code still works correctly.