Thanks to visit codestin.com
Credit goes to github.com

Skip to content

How to use the results in go-repl in another expression #3

@rocky

Description

@rocky

Haven't figured out how to use the results of a previous expression in go-repl as part of an expression.

./go-repl 
=== A simple Go eval REPL ===
go> 1+2
Kind = ptr
Type = *eval.ConstNumber
results[0] = 3
go> results[0] + 1
check error: invalid operation: results[0] + 1 (operator + not defined on interface)
go> int(results[0]) + 1
check error: cannot convert int(results[0]) to type int
go> 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions