Go - Function

Card Puncher Data Processing

Syntax

func (file *File) Write(b []byte) (n int, err error)

where:

  • (file *File) defines with which type the method function is coupled
  • Write is the name of the function
  • b []byte is the parameter of the function
  • (n int, err error) is the return variables

Parameters

As a map is a reference, a function receives a copy of the map reference (not of the data). So any changes the called function makes to the underlying data structure are also be visible through the caller’s map reference too.

Comment

Write a comment before the declaration of each function to specify its behavior. These conventions are important, because they are used by tools like go doc and godoc to locate and display documentation.





Discover More
Card Puncher Data Processing
Go - Name

in Go. “camel case”. Example: QuoteRuneToASCII and parseRequestLine but never quote_rune_to_ASCII or parse_request_line. The letters of acronyms and initialisms like ASCII and HTML are...
Card Puncher Data Processing
Go - Reference Type

Reference type in go , , , ,



Share this page:
Follow us:
Task Runner