Go: make use of multiple return values
This commit is contained in:
@@ -53,9 +53,7 @@ func main() {
|
||||
for i := 2; i < len(os.Args); i++ {
|
||||
args = append(args, *ell.NewString(os.Args[i]))
|
||||
}
|
||||
|
||||
var result []ell.V
|
||||
if !L.EvalBlock(program, args, &result) {
|
||||
if _, ok := L.EvalBlock(program, args); !ok {
|
||||
fmt.Printf("%s: %s\n", "runtime error", L.Error)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,8 +29,7 @@ import (
|
||||
)
|
||||
|
||||
func run(L *ell.Ell, program []ell.V) {
|
||||
var result []ell.V
|
||||
if !L.EvalBlock(program, nil, &result) {
|
||||
if result, ok := L.EvalBlock(program, nil); !ok {
|
||||
fmt.Printf("\x1b[31m%s: %s\x1b[0m\n", "runtime error", L.Error)
|
||||
L.Error = ""
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user