Yorick: extern

Home Manual Packages Global Index Keywords Quick Reference |
#### 1.2.5.1 `extern` statements Suppose you want to write a function which sets the value of the `theta` array used by all the variants of the `q_out` function:
    func q_out_domain(start, stop, n)
    {
      extern theta;
      theta = span(start, stop, n);
    }
Without the `extern` statement, `theta` will be a local variable, whose external value is restored when `q_out_domain` returns (thus, the function would be a no-op). With the `extern` statement, `q_out_domain` has the intended side effect of setting the value of `theta`. The new `theta` would be used by subsequent calls to `q_out`. Any number of variables may appear in a single `extern` statement:
    extern var1, var2, var3, var4;