18 lines
308 B
Go
18 lines
308 B
Go
package object
|
|
|
|
// Exit ...
|
|
func Exit(args ...Object) Object {
|
|
var status int
|
|
if len(args) == 1 {
|
|
if args[0].Type() != INTEGER_OBJ {
|
|
return newError("argument to `exit` must be INTEGER, got %s",
|
|
args[0].Type())
|
|
}
|
|
status = int(args[0].(*Integer).Value)
|
|
}
|
|
|
|
ExitFunction(status)
|
|
|
|
return nil
|
|
}
|