How to interpolate a number inside a string

go

Solution

If you want to always use the "default" representation of no matter what type, use `%v` as in

fmt.Sprintf("There are %v reasons to code!", num)

Problem

The following code ``` package main import ( "fmt" ) func main() { fmt.Println(say(9)) } func say(num int)(total string){ return fmt.Sprintf("There are %s reasons to code!", num) } ``` Produces the following output ``` There are %!s(int=9) reasons to code! ``` My question What should I do to interpolate a number inside a string?

Original source

Related problems