Skip to content

Commit

Permalink
added an eq method in the builtins **eq**
Browse files Browse the repository at this point in the history
  • Loading branch information
tacheraSasi committed Dec 7, 2024
1 parent 82de772 commit cf9e39b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions evaluator/builtins.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,22 @@ var builtins = map[string]*object.Builtin{
},
},

"eq":{
Fn: func (args ...object.Object)object.Object {
if len(args) !=2{
return newError("Sorry, convert requires 2 arguments, you provided %d", len(args))
}

a := args[0]
b := args[1]

if a == b {
return &object.Boolean{Value:true}
}
return &object.Boolean{Value:false}
},
},

"convert": {
Fn: func(args ...object.Object) object.Object {
if len(args) != 2 {
Expand Down

0 comments on commit cf9e39b

Please sign in to comment.