github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/gnovm/tests/files/method23.gno (about) 1 package main 2 3 func Bar() { 4 s := Obj.Foo() 5 println(s) 6 } 7 8 var Obj = NewT() 9 10 func NewT() *T { return &T{} } 11 12 type T struct{} 13 14 func (t *T) Foo() bool { return t != nil } 15 16 func main() { 17 Bar() 18 } 19 20 // Output: 21 // true