Standard library / bytes

bytes.Buffer.WriteByte()

Appends a byte, returns nil error; panics if buffer cannot grow. Expected stdout: '<nil> A\n'.

Formal Syntax & Structure

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

Parameters & Attributes

NameTypeDescription
cbyteData to append or write.

Return Value

error

Appends a byte, returns nil error; panics if buffer cannot grow.

Working Example

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