Multiple Return Values
Cangjie functions can achieve a "multiple return values" effect by returning tuples. Tuples use the notation (T1, T2, ...) to combine multiple values of different types together. Callers can access elements via indexing tuple[0], tuple[1], or use destructuring syntax let (a, b) = tuple to extract them directly into independent variables.
Tuples have a fixed length that cannot be changed once created. Tuples are immutable, and individual element values cannot be modified after creation. You can name each position in a tuple, such as (name: String, age: Int64), but these are just type annotations and cannot be accessed via .name.
The code on the right defines a minMax function that returns the minimum and maximum values in an array. It demonstrates two ways to receive return values: access via indexing and destructuring assignment.
Try adding an average function that returns a triple: (minimum, maximum, average).