Error G0155: Nested procedure definition

User ForumError G0155: Nested procedure definition
laurafish asked 3 years ago


I have a procedure within a procedure and an error comes up as:

Line 20 in C:\Users\youx\Code\Backward_05_20
Nested procedure definition G0155

So does GAUSS not allow nested procedure?

Thank you!

1 Answers
aptech Staff answered 3 years ago

You cannot define a GAUSS procedure inside of another GAUSS procedure. You can, however, define a GAUSS fn inside of a procedure. An fn is essentially a one-line procedure. Here is a quick example:

proc (1) = multiplyInputs(x, y);
    local out;
    fn multiply(arg1, arg2) = arg1*arg2;
    out = multiply(x, y);

You an also, of course, define the sub-procedure above or below your main procedure.