/** * Some very simple recursion **/ package main import "fmt" // A structure to hold a node in a linked list type Node struct { A int nxt *Node } // Print the linked list starting at the given node // uses recursion func prntLst(itm *Node) { if itm==nil { // do nothing } else { fmt.Printf("%v\n", itm.A) prntLst(itm.nxt) } } // func main() { hd := Node{0,nil} cc := &hd for i:=1; i<10; i++ { cc.nxt = &Node{i, nil} cc=cc.nxt } prntLst(&hd) }