use
use
Function
use is used to import fields in the object into the current scope, suitable for deconstructing configuration objects, request contexts or module return objects.
Syntax
use object use object{name, age}
Parameters
-
object: Object, required
-
fields: Identifier, optional
Example
user = {name: 'Lisa', age: 18} use user{name} println name
Notes
-
useimports object fields, not file module systems. - The imported field name will be written into the current scope as a variable name. It must comply with the variable naming rules and cannot start with a capital letter.
- Full import should avoid overwriting important variable names that already exist in the current scope.