Files
monkey/object/builtin_exit.go
Chuck Smith 99cea83f57
Some checks failed
Test / build (push) Waiting to run
Build / build (push) Has been cancelled
Add tons of builtin helpers and array operations.
2024-03-24 12:11:46 -04:00

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
}