explain-xkcd.go (292B)
1 package xkcd 2 3 import ( 4 "fmt" 5 ) 6 7 // For a given xkcd comic number `num', provide the explainxkcd.com link. 8 func ExplainXKCD(num int) (link string) { 9 if num == 0 { 10 link = fmt.Sprintf("%sMain_Page\n", explainxkcd) 11 } else { 12 link = fmt.Sprintf("%s%d\n", explainxkcd, num) 13 } 14 return link 15 }