github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/gnovm/tests/integ/debugger/sample.gno (about) 1 // This is a sample target gno program to test the gnovm debugger. 2 // See ../../cmd/gno/debug_test.go for the debugger test cases. 3 4 package main 5 6 func f(name string, i int) { 7 println(name, i) 8 } 9 10 func g(s string, n int) { 11 f(s, n) 12 } 13 14 var global = "test" 15 16 type T struct { 17 A []int 18 } 19 20 func (t *T) get(i int) int { 21 r := t.A[i] 22 if i == 0 { 23 b := "zero" 24 println(b) 25 } else { 26 b := "!zero" 27 println(b) 28 } 29 return r 30 } 31 32 func main() { 33 num := 5 34 println("in main") 35 if num > 2 { 36 b := 3 37 g("hello", b) 38 } 39 t := T{A: []int{1, 2, 3} } 40 println(t.get(1)) 41 println("bye") 42 }