Get rid of % at the end of printed output

Here is my code. I want to get rid of the % character at the end of the printed line.

package main
import “fmt”

func main() {
var scores = []int {90, 70, 50, 80, 60, 85}
var length = len(scores) // the len function returns the length of scores
for i := 0; i<length; i++ {
fmt.Printf("%d ", scores[i]) // Output: 90 70 50 80 60 85 %
}
}

After fixing the quotes around "fmt", I do not see any percent character in the output when running it on the playground: Go Playground - The Go Programming Language

Though I know, that ZSH does indeed print a percentsign with swapped back and foregroundcolors followed by a newline if the program exits and the last character printed was not a newline.

As you do not print a newline, I assume you are using ZSH.

Thanks, Norbert. Yes I’m using zsh on the Mac.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.