Standard library / strings

strings.Builder.WriteByte()

Appends a single byte and returns nil error; the byte need not be valid UTF-8 by itself. Expected stdout: '<nil> A\n'.

Formal Syntax & Structure

go syntaxgo
func (b *Builder) WriteByte(c byte) error

Parameters & Attributes

NameTypeDescription
cbyteData to append or write.

Return Value

error

Appends a single byte and returns nil error; the byte need not be valid UTF-8 by itself.

Working Example

Example Snippetgo
package main
import (  "fmt"  "strings")
func main() {  var b strings.Builder  e := b.WriteByte(65)  fmt.Println(e, b.String())}
Go Reference