Go - Function

1 - Syntax

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


  • (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

2 - 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.

3 - 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.

Data Science
Data Analysis
Data Science
Linear Algebra Mathematics

Powered by ComboStrap