Go case Study: built-in functions

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Go pre-defines a few functions, which means you can use them without referencing any packages. All of the built-in functions are listed below (as of go1.1):

Closenew Paniccomplexdeletemakerecoverreallen Appendprintimagcap copyprintln

Note: You can use the godoc builtin command to get online documentation about built-in types and functions.


Close

for channel communication. Use it to close the channel.


Delete

used to delete an instance in a map.


Len and Cap

available for different types, Len is used to return string, slice, and array lengths.


New

used for various types of memory allocations.


Make

memory allocations for built-in types (map, slice, and channel).


Copy

used to replicate slice.


Append

used to append slice.


Panic and recover

used for exception handling mechanisms.


Print and println

is the underlying print function that can be used without the introduction of the FMT package. They are primarily used for debugging.


Complex, Real and imag

all for processing complex numbers. With the simple example given earlier, no further discussion of the plural is necessary.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.