Files
monkey/internal/object/null.go
csmith f9e6e164b0
Some checks failed
Build / build (push) Successful in 10m40s
Publish Image / publish (push) Failing after 34s
Test / build (push) Has been cancelled
further improvements
2024-04-01 17:02:44 -04:00

33 lines
420 B
Go

package object
var NULL = Null{}
type Null struct{}
func (n Null) Bool() bool {
return false
}
func (n Null) Type() Type {
return NullType
}
func (n Null) Inspect() string {
return "null"
}
func (n Null) String() string {
return n.Inspect()
}
func (n Null) LogicalNot() Object {
return Boolean{!n.Bool()}
}
func (n Null) Compare(other Object) int {
if _, ok := other.(Null); ok {
return 0
}
return 1
}