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. Such a Quit leaves only the block, so no caller takes the value. In a While, Do ... While, Try or Catch block, IRIS refuses to compile it with ERROR #1043. In a For loop, IRIS compiles it and 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