Error: The callee’s public list names ‘{name}’, which is private here
The callee, a procedure, names the variable in its public list, but here it is private, as
every local of a method or Label() { } block is, so the callee reaches the public variable
of that name instead. IRIS compiles the call and runs it against that other variable,
undefined unless something outside the block set it (<UNDEFINED>). Name the variable in
this block’s own public list, or pass it as an argument.
IRIS compiles the example, and do Main^Demo.RequirePrivateVariable raises <UNDEFINED> when it runs.
ROUTINE Demo.RequirePrivateVariable
Main() Public {
Set total = 0
Do Add(5) //! A4025
Write total, !
Quit
}
Add(n) [total] {
Set total = total + n
Quit
}