error

error( message )

Throws a runtime error, which will end processing. Once called, this function will never return. The message given is displayed in the error.

When defining a function it is good practice to check for invalid inputs, and this allows you to throw an error if some are given.

// This function only allows positive numbers
def setLocation( x, y )
    if x < 0
        error( "x location cannot be negative" )
    else if y < 0
        error( "y location cannot be negative" )
    end

    // set location here
end