mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-05 03:17:50 +08:00
Let = use the error channel instead of output
This commit is contained in:
parent
b8e831f709
commit
cdea3cc9b5
|
@ -455,18 +455,17 @@ func divide(ec *EvalCtx, prod float64, nums ...float64) {
|
|||
out <- String(fmt.Sprintf("%g", prod))
|
||||
}
|
||||
|
||||
var ErrNotEqual = errors.New("not equal")
|
||||
|
||||
func eq(ec *EvalCtx, args []Value) {
|
||||
out := ec.ports[1].Chan
|
||||
if len(args) == 0 {
|
||||
throw(ErrArgs)
|
||||
}
|
||||
for i := 0; i+1 < len(args); i++ {
|
||||
if args[i] != args[i+1] {
|
||||
out <- Bool(false)
|
||||
return
|
||||
throw(ErrNotEqual)
|
||||
}
|
||||
}
|
||||
out <- Bool(true)
|
||||
}
|
||||
|
||||
func deepeq(ec *EvalCtx, args []Value) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user