13. Multiple Assignments
A range may be assigned using a list of expressions with the following syntax:range = { e1, e2, ... }If the list contains fewer elements than the range being assigned, the list will be traversed more than once. If the list contains too many elements a warning message will be displayed. The list can contain empty elements to skip the associated cell assignments:
% cat expr_list.ss a0:c2 = { 1, , 3, 4,, 6}; print values; % ss < expr_list.ss
A B C 0 1.00 3.00 1 4.00 6.00 2 1.00 3.00
Some functions can return more than one value. The syntax for assigning multiple return values uses braces for grouping:
{ r1, r2, ... } = func(...)where r1, r2, etc. may be symbols, cells, or ranges. For example:
{ f, e} = frexp( a); // get fraction and exponent { a0, s, c0:d0} = stats( g0:g9); // get avg, stdev, min, and max { c0:d0} = stats( g0:g9); // just get avg and stdev {a0} = stats( g0:g9); // just get avg, formula is in cell a0 a0 = stats( g0:g9); // same as aboveFormulas which use multiple return values are stored in the symbol table, and are evaluated whenever the symbol table is evaluated. They are automatically named $1, $2, etc.