bish icon indicating copy to clipboard operation
bish copied to clipboard

Unclear error message on syntax error.

Open akalsi87 opened this issue 8 years ago • 1 comments

The following snippet complains that newval is not defined, however it is.

def slice_lines(val, start) {
    nlines = numlines(val)
    if (nlines < 2) {
        println("Error1.")
        quit(0)
    }
    newval = ""
    for (curr in 1 .. nlines) {
        line = getline(val, curr)
#        if (curr >= start) {
            println("Got line: $line")
#            if (curr != start) {
#                newval = printf("$newval\n$chompline")
#            }
        }
    }
    return newval
}

Error:

Bish error: Undefined variable "newval"
Abort

akalsi87 avatar Jan 27 '16 19:01 akalsi87

The real error here is:

#            }
        } <---- this line should be commented
    }
    return newval

akalsi87 avatar Jan 27 '16 19:01 akalsi87