3 ms·
example session: (llgo) 1+1 #0 untyped int = 2 (llgo) x := 1 x untyped int = 1 (llgo) x++ (llgo) x #0 int = 2 (llgo) import "fmt" (llgo) fmt.
by f2f 12y ago
example session:
(llgo) 1+1
#0 untyped int = 2
(llgo) x := 1
x untyped int = 1
(llgo) x++
(llgo) x
#0 int = 2
(llgo) import "fmt"
(llgo) fmt.Println("hello world")
hello world
#0 int = 12
#1 error (<nil>) = <nil>
(llgo) for i := 0; i != 3; i++ {
fmt.Println(i)
}
0
1
2
(llgo) func foo() {
fmt.Println("hello decl")
}
(llgo) foo()
hello decl
(llgo) import "golang.org/x/tools/go/types"
# golang.org/x/tools/go/ast/astutil
# golang.org/x/tools/go/exact
# golang.org/x/tools/go/types
(llgo) types.Eval("1+1", nil, nil)
#0 golang.org/x/tools/go/types.TypeAndValue = {mode:4 Type:untyped int Value:2}
#1 error (<nil>) = <nil>