This is a creation in Article, where the information may have evolved or changed. The BUILTIN package contains various types of Go languages: <pre><code>unint8, UInt16, UInt32, Uint64int8, Int16, Int32, Int64float32, Float64, complex64, complex128string, int, uintptr, byte, runeconst iota = 0, niltype error interface {}</code></ Pre> and common built-in functions: ' Func append (slice []type, Elems ... Type) []typefunc copy (DST, src []type) intfunc Delete (M map[type]type1, key Type)//array, pointer, slice, string, channel Func len (v type) IntFunc cap (v type) int//slice, map, chanfunc make (t type, size ... Integertype) Typefunc New (Type) *typefunc complex (R, I floattype) Complextypefunc Real (c ComplexType) Floattypefunc Imag ( C ComplexType) Floattypefunc Close (c chan<-Type) func panic (v interface{}) func recover () interface{}func print (args: . Type) func println (args ... Type) The following is a simple program that uses built-in functions: ~~~package MainFunc Main () {//Make a slice, copy, Lens: = Make ([]string, 0) s = append (S, "Apple ") s = append (S," Orange "," Peach ") println (" Len of S: ", Len (s)) for I, V: = range S {println (i, v)}s2: = Make ([]string, 5) N: = Copy (s2, s) println ("Len of S2:", Len (S2)) println ("Copied len:", N) for I, V: = Range S2 {println (i, v)}//make a channel, close a CHANNELC: = Make (Chan string, 2) C <-"Dolphin" C <-"Shark" println (<-c) println (<-c) c <-"Seal" println (<-c) Close (c) If _, OK: = <-c; OK {println ("channel is Open")} else {println ("channel is closed")}}~~~217 click ∙ 1 likes
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