ascot diagnostics

A4963

Error: Quit inside a loop or Try block takes no value; this one carries {actual}

This Quit carries a value inside a For, While, Do ... While, Try or Catch block, which it leaves instead of the method, so it has no caller to hand the value to. IRIS refuses to compile it in a While, Do ... While, Try or Catch block (QUIT argument not allowed), and compiles it in a For loop but raises <COMMAND> when it runs. Leave the block with a bare Quit and return the value after it, or Return it from inside.

IRIS compiles the example, and do ##class(Demo.QuitXInControl).FirstNegative($ListBuild(1, -2, 3)) raises <COMMAND> when it runs.

Class Demo.QuitXInControl
{

ClassMethod FirstNegative(list As %List) As %Integer
{
    For i = 1:1:$ListLength(list) {
        Set item = $List(list, i)
        If item < 0 Quit item //! A4963
    }
    Quit 0
}

}

All diagnostics