Files
monkey/object/int.go
Chuck Smith b4ba660704
Some checks failed
Build / build (push) Successful in 10m31s
Test / build (push) Failing after 39m25s
rearrange builtins
2024-03-24 14:00:22 -04:00

27 lines
462 B
Go

package object
import "fmt"
type Integer struct {
Value int64
}
func (i *Integer) Type() ObjectType {
return INTEGER_OBJ
}
func (i *Integer) Inspect() string {
return fmt.Sprintf("%d", i.Value)
}
func (i *Integer) Clone() Object {
return &Integer{Value: i.Value}
}
func (i *Integer) String() string {
return i.Inspect()
}
func (i *Integer) Equal(other Object) bool {
if obj, ok := other.(*Integer); ok {
return i.Value == obj.Value
}
return false
}