I have this piece of code
a := 32
fmt.Printf("%d", a)
the output is
32%
when anyone would expect
32
Could it be a terminal effect? I am using zsh.
The issue is that Printf doesn't add a newline. The '%' you are seeing is your bash / shell prompt.
Try this:
fmt.Printf("%d\n", 32)
The \n
will add a newline, and your prompt will now be on the next line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With